systopia / de.systopia.osm

CiviCRM OpenStreetmap GeoCoding-Provider
2 stars 17 forks source link

Postal Code not working properly with Nominatim #5

Open Detsieber opened 9 years ago

Detsieber commented 9 years ago

The following seems to be a problem of nominatim, respective the data of OSM. However, there might be a workaround in the OSM extension:

The problem: Very often, the address is not found, when there is a postal code within the address. E.g. in the Logfile, I see the following line:

Jul 01 12:46:09 [info] Geocoding failed. No results for: http://nominatim.openstreetmap.org/search?format=json&street=Platz+der+Republik+1&city=Berlin&postalcode=11011&country=Germany&addressdetails=1

I analyzed this on the nominatim UI at http://nominatim.openstreetmap.org and entered

Platz der Republik 1 Berlin 11011

This gave no search result. Then I left off the postal code:

Platz der Republik 1 Berlin

and voilà, the address was identified.

As a workaround, I commented out the respective lines of code in OpenStreetMapCoding.php: 113 if (CRM_Utils_Array::value('postal_code', $values)) { 114 $params['postalcode'] = $values['postal_code']; 115 }

Now, geocoding seems to work much better, and many addresses that previously weren't geocoded, are working well now.

Any ideas about that?

bjendres commented 8 years ago

I tried to reproduce the issue, and I get the postal code "10557" (not "11011") for "Platz der Republik 1 Berlin". And if you search for "Platz der Republik 1 Berlin 10557" the results show up as expected.

From my point of view, this behaviour is correct: If you supply the wrong postal code, there should be no match. And you should not simply remove the postal code from the query, because sometimes the postal code might be right, and the street name wrong...

@Detsieber: Could you give me an example with the described problem when you supply the correct postal code? Otherwise, can I close this ticket?

Detsieber commented 8 years ago

Sorry, but I believe in the official website of Deutscher Bundestag, regarding the address: https://www.bundestag.de/service/kontakt There they say, the postal code is 11011. And we have lots of contacts, obviously, with that address - that originally didn't get geocoded.

In fact, I could imagine, that 11011 is a special postal code, such as those used for postboxes, where we wil have the same problem. In my opinion, the ticket cannot yet be closed, but has to be thought through.