Skip to content

Commit

Permalink
[FIX] adapt nominatim API URL
Browse files Browse the repository at this point in the history
Using the URL /search/ with trailing slashe is no longer supported

see osm-search/Nominatim#3134
  • Loading branch information
infabo authored Aug 29, 2023
1 parent ac3a41d commit c79464a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Classes/FormEngine/FieldControl/LocationMapWizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ public function render(): array
// if we have at least some address part (saves geocoding calls)
if ($address) {
// base url
$geoCodeUrlBase = 'https://nominatim.openstreetmap.org/search/';
$geoCodeUrlBase = 'https://nominatim.openstreetmap.org/search?q=';
$geoCodeUrlAddress = $address;
$geoCodeUrlCityOnly = ($row['city'] ?? '');
// urlparams for nominatim which are fixed.
$geoCodeUrlQuery = '?format=json&addressdetails=1&limit=1&polygon_svg=1';
$geoCodeUrlQuery = '&format=json&addressdetails=1&limit=1&polygon_svg=1';
// replace newlines with spaces; remove multiple spaces
$geoCodeUrl = trim(preg_replace('/\s\s+/', ' ', $geoCodeUrlBase . $geoCodeUrlAddress . $geoCodeUrlQuery));
$geoCodeUrlShort = trim(preg_replace('/\s\s+/', ' ', $geoCodeUrlBase . $geoCodeUrlCityOnly . $geoCodeUrlQuery));
Expand Down

0 comments on commit c79464a

Please sign in to comment.