pelias / api

HTTP API for Pelias Geocoder
http://pelias.io
MIT License
221 stars 162 forks source link

Street matching fails on self hosted installation #1613

Open fl0cke opened 2 years ago

fl0cke commented 2 years ago

Hey,

I'm running a self hosted installation of Pelias for some internal applications and i've observed some strange behavior.

Whenever i search for a street only using its abbreviated form (e.g. Woogstr. instead of Woogstraße), Pelias is unable to find it. However, when i use the full street name, it suddenly appears. Here is an example:

Woogstr. Frankfurt ``` { "geocoding": { "version": "0.2", "query": { "text": "Woogstr. Frankfurt", "size": 10, "layers": [ "venue", "street" ], "private": false, "lang": { "name": "German", "iso6391": "de", "iso6393": "deu", "via": "header", "defaulted": false }, "querySize": 20, "parser": "libpostal", "parsed_text": { "street": "woogstr.", "city": "frankfurt" } }, "warnings": [ "performance optimization: excluding 'address' layer", "Invalid Parameter: api_key" ], "engine": { "name": "Pelias", "author": "Mapzen", "version": "1.0" }, "timestamp": 1646327416772 }, "type": "FeatureCollection", "features": [ { "type": "Feature", "geometry": { "type": "Point", "coordinates": [ 8.584764, 50.041821 ] }, "properties": { "id": "101913837", "gid": "whosonfirst:locality:101913837", "layer": "locality", "source": "whosonfirst", "source_id": "101913837", "country_code": "DE", "name": "Frankfurt am Main", "confidence": 0.6, "match_type": "fallback", "accuracy": "centroid", "country": "Deutschland", "country_gid": "whosonfirst:country:85633111", "country_a": "DEU", "region": "Hessen", "region_gid": "whosonfirst:region:85682531", "region_a": "HE", "macrocounty": "Darmstadt", "macrocounty_gid": "whosonfirst:macrocounty:404227581", "county": "Frankfurt", "county_gid": "whosonfirst:county:102063589", "county_a": "FA", "localadmin": "Frankfurt am Main", "localadmin_gid": "whosonfirst:localadmin:1377692799", "locality": "Frankfurt am Main", "locality_gid": "whosonfirst:locality:101913837", "continent": "Europa", "continent_gid": "whosonfirst:continent:102191581", "label": "Frankfurt am Main, HE, Deutschland" }, "bbox": [ 8.472633, 50.015574, 8.800535, 50.226257 ] }, { "type": "Feature", "geometry": { "type": "Point", "coordinates": [ 8.554388, 50.038448 ] }, "properties": { "id": "85796795", "gid": "whosonfirst:neighbourhood:85796795", "layer": "neighbourhood", "source": "whosonfirst", "source_id": "85796795", "country_code": "DE", "name": "Frankfurt Main", "confidence": 0.6, "match_type": "fallback", "accuracy": "centroid", "country": "Deutschland", "country_gid": "whosonfirst:country:85633111", "country_a": "DEU", "region": "Hessen", "region_gid": "whosonfirst:region:85682531", "region_a": "HE", "macrocounty": "Darmstadt", "macrocounty_gid": "whosonfirst:macrocounty:404227581", "county": "Frankfurt", "county_gid": "whosonfirst:county:102063589", "county_a": "FA", "localadmin": "Frankfurt am Main", "localadmin_gid": "whosonfirst:localadmin:1377692799", "locality": "Frankfurt am Main", "locality_gid": "whosonfirst:locality:101913837", "neighbourhood": "Frankfurt Main", "neighbourhood_gid": "whosonfirst:neighbourhood:85796795", "continent": "Europa", "continent_gid": "whosonfirst:continent:102191581", "label": "Frankfurt Main, Frankfurt am Main, HE, Deutschland" }, "bbox": [ 8.46320556641, 49.9862639366, 8.61092163086, 50.0699473416 ] }, { "type": "Feature", "geometry": { "type": "Point", "coordinates": [ 14.529218, 52.345365 ] }, "properties": { "id": "101748801", "gid": "whosonfirst:locality:101748801", "layer": "locality", "source": "whosonfirst", "source_id": "101748801", "country_code": "DE", "name": "Frankfurt (Oder)", "confidence": 0.6, "match_type": "fallback", "accuracy": "centroid", "country": "Deutschland", "country_gid": "whosonfirst:country:85633111", "country_a": "DEU", "region": "Brandenburg", "region_gid": "whosonfirst:region:85682553", "region_a": "BB", "county": "Frankfurt", "county_gid": "whosonfirst:county:102063919", "county_a": "FM", "localadmin": "Frankfurt (Oder)", "localadmin_gid": "whosonfirst:localadmin:1377694183", "locality": "Frankfurt (Oder)", "locality_gid": "whosonfirst:locality:101748801", "continent": "Europa", "continent_gid": "whosonfirst:continent:102191581", "label": "Frankfurt (Oder), BB, Deutschland" }, "bbox": [ 14.3948344154, 52.2527720062, 14.6013551876, 52.3982333484 ] }, { "type": "Feature", "geometry": { "type": "Point", "coordinates": [ 8.660333, 50.124823 ] }, "properties": { "id": "102063589", "gid": "whosonfirst:county:102063589", "layer": "county", "source": "whosonfirst", "source_id": "102063589", "country_code": "DE", "name": "Frankfurt", "confidence": 0.4, "match_type": "fallback", "accuracy": "centroid", "country": "Deutschland", "country_gid": "whosonfirst:country:85633111", "country_a": "DEU", "region": "Hessen", "region_gid": "whosonfirst:region:85682531", "region_a": "HE", "macrocounty": "Darmstadt", "macrocounty_gid": "whosonfirst:macrocounty:404227581", "county": "Frankfurt", "county_gid": "whosonfirst:county:102063589", "county_a": "FA", "continent": "Europa", "continent_gid": "whosonfirst:continent:102191581", "label": "Frankfurt, HE, Deutschland" }, "bbox": [ 8.472633, 50.015574, 8.800535, 50.226257 ] }, { "type": "Feature", "geometry": { "type": "Point", "coordinates": [ 14.498635, 52.329664 ] }, "properties": { "id": "102063919", "gid": "whosonfirst:county:102063919", "layer": "county", "source": "whosonfirst", "source_id": "102063919", "country_code": "DE", "name": "Frankfurt", "confidence": 0.4, "match_type": "fallback", "accuracy": "centroid", "country": "Deutschland", "country_gid": "whosonfirst:country:85633111", "country_a": "DEU", "region": "Brandenburg", "region_gid": "whosonfirst:region:85682553", "region_a": "BB", "county": "Frankfurt", "county_gid": "whosonfirst:county:102063919", "county_a": "FM", "continent": "Europa", "continent_gid": "whosonfirst:continent:102191581", "label": "Frankfurt, BB, Deutschland" }, "bbox": [ 14.394834, 52.252772, 14.601355, 52.398233 ] }, { "type": "Feature", "geometry": { "type": "Point", "coordinates": [ 10.53333, 49.68333 ] }, "properties": { "id": "1393604339", "gid": "whosonfirst:neighbourhood:1393604339", "layer": "neighbourhood", "source": "whosonfirst", "source_id": "1393604339", "country_code": "DE", "name": "Frankfurt", "confidence": 0.6, "match_type": "fallback", "accuracy": "centroid", "country": "Deutschland", "country_gid": "whosonfirst:country:85633111", "country_a": "DEU", "region": "Bayern", "region_gid": "whosonfirst:region:85682571", "region_a": "BY", "macrocounty": "Mittelfranken", "macrocounty_gid": "whosonfirst:macrocounty:404227565", "county": "Landkreis Neustadt an der Aisch-Bad Windsheim", "county_gid": "whosonfirst:county:102063505", "county_a": "NA", "localadmin": "Scheinfeld", "localadmin_gid": "whosonfirst:localadmin:1377689853", "locality": "Markt Taschendorf", "locality_gid": "whosonfirst:locality:101826875", "neighbourhood": "Frankfurt", "neighbourhood_gid": "whosonfirst:neighbourhood:1393604339", "continent": "Europa", "continent_gid": "whosonfirst:continent:102191581", "label": "Frankfurt, Markt Taschendorf, BY, Deutschland" }, "bbox": [ 10.52833, 49.67833, 10.53833, 49.68833 ] } ], "bbox": [ 8.46320556641, 49.67833, 14.6013551876, 52.3982333484 ] } ```
Woogstraße Frankfurt ``` { "geocoding": { "query": { "text": "Woogstraße Frankfurt", "size": 10, "layers": [ "venue", "street" ], "private": false, "lang": { "name": "German", "iso6391": "de", "iso6393": "deu", "via": "header", "defaulted": false }, "querySize": 20, "parser": "libpostal", "parsed_text": { "street": "woogstraße", "city": "frankfurt" } }, "warnings": [ "performance optimization: excluding 'address' layer", "Invalid Parameter: api_key" ], "engine": { "name": "Pelias", "author": "Mapzen", "version": "1.0" }, "timestamp": 1646327630751 }, "type": "FeatureCollection", "features": [ { "type": "Feature", "geometry": { "type": "Point", "coordinates": [ 8.647136, 50.145215 ] }, "properties": { "id": "polyline:96287", "gid": "openstreetmap:street:polyline:96287", "layer": "street", "source": "openstreetmap", "source_id": "polyline:96287", "country_code": "DE", "name": "Woogstraße", "street": "Woogstraße", "confidence": 1, "match_type": "exact", "accuracy": "centroid", "country": "Deutschland", "country_gid": "whosonfirst:country:85633111", "country_a": "DEU", "region": "Hessen", "region_gid": "whosonfirst:region:85682531", "region_a": "HE", "macrocounty": "Darmstadt", "macrocounty_gid": "whosonfirst:macrocounty:404227581", "county": "Frankfurt", "county_gid": "whosonfirst:county:102063589", "county_a": "FA", "localadmin": "Frankfurt am Main", "localadmin_gid": "whosonfirst:localadmin:1377692799", "locality": "Frankfurt am Main", "locality_gid": "whosonfirst:locality:101913837", "neighbourhood": "Römerstadt", "neighbourhood_gid": "whosonfirst:neighbourhood:85796311", "label": "Woogstraße, Frankfurt am Main, HE, Deutschland", "index": 0 }, "bbox": [ 8.644728, 50.144572, 8.648875, 50.145328 ] } ], "bbox": [ 8.644728, 50.144572, 8.648875, 50.145328 ] } ```

For comparison, when i search for the same street using dev.api.geocode.earth, it finds it no problem!

https://pelias.github.io/compare/#/v1/search?text=Woogstr.+Frankfurt

I've previously opened an issue for a similar bug (https://github.com/pelias/api/issues/1594), but this seems to be a different issue. However, i'm not sure if this is actually is a bug in the code or just a problem with the imported data, because the street is clearly there! I'm using the latest version of Pelias and the polylines were imported following the instructions at pelias/polylines using an up-to-date OSM extreact.

Any help is very much appreciated!

missinglink commented 2 years ago

Please check all the software is up-to-date, the code which handles street suffix contraction/expansion has been around for some years now.

There is also some other code specific to these seperable street suffixes in Germany speaking countries which should be functioning: https://github.com/pelias/model/blob/master/test/post/seperable_street_names.js

The most recent work in that area was in January this year and specific to your example (compound word + abbreviated) https://github.com/pelias/model/pull/145

The corresponding update in polylines is https://github.com/pelias/polylines/commit/cf2a2d8ad1d025a61141838e1af6f47c5d52d44d