Skip to content

Discussion for PR to improve accuracy of reverse geocoding #357

@LEDfan

Description

@LEDfan

Hi

We are looking into using Photon as a (reverse) geocoding solution. The speed and simple setup is great, thanks for that 👍!

Currently we are bumping into some inaccuracies when reverse geocoding. Especially on parts of roads where no building are nearby.

To give an example, the point lat 51.32965, lon: 4.52222, is giving weird results:

The big difference between Nominatim and Photon is of course that Nominatim is using PostGIS and Photon is using ES. I did some research and I think the problem is that Nominatim is comparing the distance of an object to its full shape and Photon don't. Instead Photon only looks at some points of the object. This is not a surprise since ES doesn't support such a query (elastic/elasticsearch#13351).

I have a possible solution that basically works as follows:

  • when indexing ES with data from Nominatim, check if the object is a highway
  • if so, divide the highway into straight parts (using the ST_DumpPoints PostGIS function).
  • loop over all these parts:
    • if a part is larger than 20 meters: split this part into points, where the distance between two continuously points is 20 meters

These two images explains it (the second image is indexed with 50 meters distance, but this isn't good enough).
selection_005
selection_002

I open this issue because I want to know if you are interested in accepting a PR for this.
A POC implementation is available at https://github.com/komoot/photon/compare/master...inuits:indexed_shapes?expand=1. It needs some polishing (and maybe some tests) but it is working fine here. The same example now returns Essensteenweg.
During import from Nominatim I don't see a (significant) impact, also the ES database doesn't grow much.

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions