pelias / api

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

Returning coordinates at the correct side of the street #1605

Open lucas-abbate opened 2 years ago

lucas-abbate commented 2 years ago

Use-cases

Our team wants to categorize houses according to their census tract, based on the people's address. Most census tracts (at least in Argentina's big cities) are defined by 2 o 3 squares and use streets as delimiters. Therefore, being able to determine on which side of the street a house is is key.

Proposal

I don't even know if it is possible to return the side of the road based on the address, but in Argentina (and I think in some other countries too), one side of a street is even while the other is odd. Also, other geocoders like Nominatim (or Google Maps), returns the coordinates on the correct side of the street.

Captura de pantalla 2022-02-22 171615

(the yellow dots are extracted from Nominatim, the red ones from Pelias, and the green lines are the census tracts. There are fewer because we are still running our queries, but by checking their info, some should be on a side and the rest on the other).

Thanks for the attention and sorry for the poor english :)

missinglink commented 2 years ago

Have a look at https://github.com/pelias/interpolation

lucas-abbate commented 2 years ago

Isn't that what I've done when installing Pelias??

missinglink commented 2 years ago

Pelias is composed of several smaller components, the interpolation service is a SQLite database which is built independently of the elasticsearch index.

So while the interpolation database preserves the side of the street (what is called 'parity' in the SQLite database) it's not exposed to other services as this requirement has never been requested before.

If you have installed Pelias using the pelias/docker utility then you will find the address.db and street.db SQLite databases in your configured DATA_DIR.

I recommend you have a look in the address.db as it likely has the information you require.

missinglink commented 2 years ago

Out of curiosity; how do you define 'left' and 'right'? We base it on the bearing from the start point to the end point of the linestring, but this can obviously be reversed and therefore return the opposite classification, do you have a suggestion of how best to normalize this?

lucas-abbate commented 2 years ago

I've seen the parity thing. Is there a way to find out on whick side the linestring starts and then define left or right? Maybe the linestrings could be arbitrarily defaulted to start always on the same side (i.e, the southern dot of the linestring is always the start). Then, all left or right side could be normalized (but I don't know if it is possible to arbitrarily define the starting point of the linestring). Anyways. Thanks for the help!

missinglink commented 2 years ago

No problem, please close this issue if you found a solution.

missinglink commented 2 years ago

Like you mentioned, you could (for instance) select the most southerly point as the starting point, it would make the calculation deterministic but I don't think that would guarantee that Argentine addresses are given the correct parity.

I was wondering if the Argentinian authority has some sort of official policy in this regard about which is the start and the end of a street?