Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search for intersections #123

Open
projectsharespace2013 opened this issue Apr 2, 2014 · 8 comments
Open

Search for intersections #123

projectsharespace2013 opened this issue Apr 2, 2014 · 8 comments

Comments

@projectsharespace2013
Copy link

In Quito street numbering is almost nonexistent therefore it is very important we be able to search by cross streets.

Here is an example of the issue, you will see it cannot find the intersection.
http://www.openstreetmap.org/search?query=isla%20genovesa%20and%20rio%20coca#map=20/-0.20478/-78.49193&layers=HN

@lonvia lonvia changed the title Cannot search for cross streets Search for intersections Aug 8, 2015
@narigondelsiglo
Copy link

Is this in somebody plans?

@lonvia
Copy link
Member

lonvia commented Feb 27, 2018

Not in the immediate future.

@VeryStupid
Copy link

VeryStupid commented Apr 6, 2019

Hi @lonvia , I am relatively new to the OSM community. I want to help and I am particularly interested in search improvement and I would like to try and take on this specific issue. Before I just start digging into code and whatnot I thought I would reach out to you or someone that could provide any guidance, tips etc.
Thank you,
Gary

@lonvia
Copy link
Member

lonvia commented Apr 7, 2019

Hi @VeryStupid, you are warmly welcome to tackle this issue. I don't have yet a clear idea how intersection search should be implemented, so let me just elaborate a bit more on the problem.

There are basically two issues to solve. The first is how to detect in a free-form search term that the user is searching for an intersection. This part involves doing a bit of research in which countries intersection searches are commonly used and how they are formulated. Maybe there is a signal word that can be detected and be useful, maybe this needs another solution.

The second problem is how to find the intersections in the database. The two extremes are: a) doing to searches and finding intersections between the results and b) precomputing all intersections in the world. They both have different implications for query speed and storage space that need to be explored. The actual solution is likely somewhere in between.

The two issues are not completely separate. For example, if we'd really precompute all the intersections then they would have a name like any other object in the database (e.g. name='6th and 8th') and it wouldn't be necessary to 'detect' an intersection query at all.

My recommendation would be to start with a small area extract and just get something working as a proof of concept, maybe trying the two extremes above. From the experiences collected, we can discuss how to best scale up.

@jomo
Copy link

jomo commented May 12, 2020

I'd love to see this added as well!

Intersections are commonly used in Germany. While they aren't used for official addresses, they are frequently used as reference points, e.g. to describe your current position, or where to meet with your friend. If a building is located at an intersection, its location may also be given with the name of the intersection rather than the official address.

Street names are usually unique within a German City. There are sometimes exceptions, but I haven't heard of two intersections of different streets existing twice within a City.

To find an intersection of streets A and B, you could search for a street named A, then find its nodes that are also part of street B.

In spoken German language, intersections are usually referenced as "A-Street, Ecke B-Street" (Ecke = corner). This is also common in written form, but the streets might also just be separated by a , or /.

Google Maps seems to separate streets with &, regardless of the language (?).

Example:

Note that this example has a gotcha: The street has two intersections with the other street.
IMO this should return two equally ranked results.

@lonvia
Copy link
Member

lonvia commented May 19, 2020

@blackham
Copy link

I would love to see an intersection feature too.

To answer "The first is how to detect in a free-form search term that the user is searching for an intersection"
In English any time the parser sees the word "With" you know you are dealing with intersections. 1100 East with 500 South.
In Espanol any time the parser sees the word "Con". CRA 26 CON CALLE 80C, Cali, Colombia

intersection_key_words = [" with "," con "," ecke ",...]
if address.include? intersection_key_words
   ...
else
 ....
end

As for "The second problem is how to find the intersections in the database". Split the two streets and do a search in the city for them. It's twice the work for the DB, but after that you should be able to do the intersection work in memory. If the results of the two streets ever touch, then you got a match.

If the city wasn't given, you can still limit the search by finding all the streets in the world for street A. Then limit the results for street B by only searching cities returned from street A. That would reduce the search matrix, which is still in memory so it should go fast once you had all the results. I'm not sure how detailed the DB is, but if you know the spoken languages of an area, you could further narrow down the search. If "con" (ESP) is used, then only find results in countries that speak ESP. But I don't think you need to be that picky.

As a workaround for now, anytime I see "CON", I'm going to split the two streets and do the search for each in the city. I'll be building a heatmap so the middle of the street will mostly work. I could go a step further and take the lat/long of the two streets and find the middle (avg) between them. If I had to find the REAL intersection, I know tools exist that will tell you where line A intersects line B. But I think it's in JS and I'd rather eat my own head than touch that.

if street.include?(" con ")
  [street_a, street_b] = street.split(" con ")
  [lat_a, long_a] = find_loc(street_a)
  [lat_b, long_b] = find_loc(street_b)
  find_middle(lat_a, long_a, lat_b, long_b)
else
  find_loc(street)
end
  • Not the intersection, but close enough for a #### (stupid woke world has no sense of humor)

@dkolan
Copy link

dkolan commented Jan 4, 2023

I'm creating a crime data analysis application where some of the locations provided by the law enforcement reports include cross streets as opposed to concrete addresses or block numbers. This would be a much appreciated feature for myself as well. I like the approach mentioned above looking for intersections by comparing latitude and longitude and will likely do something like that in the meantime.

calglu added a commit to RajibAlam43/milwaukee911 that referenced this issue Feb 14, 2023
Converts Location column to latitude /longitude. 

-Selects 20 random records which haven't been geocoded.

-Does some data cleaning.  (Saves cleaned Location in "Processed Location" in MPD.GEOCODED.

-"Solves" OSM Nominatim Intersection search, which seems to be an open problem (osm-search/Nominatim#123). Intersection solution tries 3 methods and utilizes linear regression & traveling salesman problem.  The solution may result in lat/long coordinates that are not perfectly accurate, but it allows us to avoid using google API for bulk requests which would potentially cost us money. 

-Copies lat/long/processed_location to any records which haven't been geocoded IF those records have a Location value which has already been geocoded.

This file will be put on a crontab 

Signed-off-by: calglu <82549313+calglu@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Planning board
  
Blue sky
Development

No branches or pull requests

7 participants