komoot / photon

an open source geocoder for openstreetmap data
Apache License 2.0
1.92k stars 281 forks source link

Edge Case for combined address #696

Open xeruf opened 1 year ago

xeruf commented 1 year ago

I encountered an example where I tried to geocode Fichtestraße 1-4, 08451 Crimmitschau Chemnitz.

It fails, even though two query variations which would combine into it work out:

curl 'https://photon.komoot.io/api/?q=Fichtestraße%201-4,%2008451%20Crimmitschau%20Chemnitz&lang=de&limit=1'
{"features":[],"type":"FeatureCollection"}

curl 'https://photon.komoot.io/api/?q=Fichtestraße%201-4,%2008451%20Crimmitschau&lang=de&limit=1'
{"features":[{"geometry":{"coordinates":[12.393781675026666,50.80871965],"type":"Point"},"type":"Feature","properties":{"osm_id":570446453,"extent":[12.3937017,50.8088135,12.3938617,50.8086258],"country":"Deutschland","city":"Crimmitschau","countrycode":"DE","postcode":"08451","locality":"Wahlen","county":"Zwickau","type":"house","osm_type":"W","osm_key":"building","housenumber":"1","street":"Fichtestraße","district":"Crimmitschau","osm_value":"yes","state":"Sachsen"}}],"type":"FeatureCollection"}

curl 'https://photon.komoot.io/api/?q=Fichtestraße%201,%2008451%20Crimmitschau%20Chemnitz&lang=de&limit=1'
{"features":[{"geometry":{"coordinates":[12.393781675026666,50.80871965],"type":"Point"},"type":"Feature","properties":{"osm_id":570446453,"extent":[12.3937017,50.8088135,12.3938617,50.8086258],"country":"Deutschland","city":"Crimmitschau","countrycode":"DE","postcode":"08451","locality":"Wahlen","county":"Zwickau","type":"house","osm_type":"W","osm_key":"building","housenumber":"1","street":"Fichtestraße","district":"Crimmitschau","osm_value":"yes","state":"Sachsen"}}],"type":"FeatureCollection"}

Is it possible to fix cases like this?

lonvia commented 1 year ago

There are two errors in that address. There is no housenumber '1-4' and the address is not in Chemnitz. That's a bit too much even for fuzzy search. It is extremely difficult to accommodate for cases like this without making other searches return worse results. So the answer would be: no, sorry, it's unlikely to be fixable. You have to clean your input on the client side.