Add support for displaying municipality in AzureMaps autocomplete results#1242
Add support for displaying municipality in AzureMaps autocomplete results#1242jbelien merged 7 commits intogeocoder-php:masterfrom
Conversation
|
All good 👍 Thanks for your contribution! Could you just add a test about this change? |
|
I've added a test to verify that the municipality (city) is properly included in the geocode response. Let me know if anything more is needed. Thank you for your fantastic job! |
|
Could you make sure all failing checks are passing? PHP CS Fixer is "just" a linting/formatting issue. Thanks! |
|
Hi! I am sorry for that, that was my first time doing this :) I cleaned it with php vendor\bin\php-cs-fixer fix, and afterwards tested with php vendor\bin\phpunit -c phpunit.xml.dist --filter=AzureMapsTest. It generated same cache file. There was 1 failure:
C:\inetpub\wwwroot\github_projects\Geocoder\src\Provider\AzureMaps\Tests\AzureMapsTest.php:115 FAILURES! |
We noticed that the autocomplete functionality in the AzureMaps provider was missing the ability to display the municipality (city). This was causing incomplete location suggestions, as cities were not included in the results.
To fix this, we added the following line to the formatGeocodeResponse function:
$builder->setLocality($result->address->municipality ?? null);Now, when searching for an address like Via Giuseppe Garibaldi 62, IT, Italy, the autocomplete properly returns results that include city names. This improves the accuracy and usability of the geocoding provider.
Let us know if any adjustments are needed! 🚀