NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

I want to implement an A* Search Algorithm with OSM, but how can I get the coordinates just from the streets, not from the houses etc? And how can I get the neighbor's coordinates from this specific street coordinate? How can I identify crossroads? Does someone have an idea? I need this to trace a route, but using my own algorithm *Coordinates= Latitude,Longitude

asked 21 Jul '13, 03:02

user's gravatar image

user
26113
accept rate: 0%

edited 22 Jul '13, 01:24


You need to read up on the basics of the OSM data model, e.g. on the Wiki. This will give you an idea of how to identify what is a street. You will then be able to process an OSM data set and export streets only, or identify crossroads. Finding neighbour's coordinates is a simple geometric problem. Many people will have "an idea" about this but the space here is too short to explain it all! It is possible that importing OSM data into a spatial database (e.g. imposm, osm2pgsql - read other answers about these in this help system) will help you, since you can then query the database for geometries or things like nearest neighbours.

permanent link

answered 21 Jul '13, 17:13

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273
accept rate: 23%

how can I get the neighbor's coordinates from a specific street coordinate?

(22 Jul '13, 18:20) user

I have to download the spatial database? I can't do this using HTTP request?

(23 Jul '13, 03:58) user
3

To do anything directly with the OSM data (such as routing) you'll almost certainly want to download an extract of the data (such as from one of the links here) first.

(23 Jul '13, 09:55) SomeoneElse ♦
2

You have to download the data and prepare it in a suitable fashion. You cannot use an API for what you want to do because you need access to much more data than you can download from the API, and your algorithm would be terribly slow. Getting the neighbour's coordinate is a geometric problem that e.g. a PostGIS database would solve for you (search the web for "nearest point postgis" or so).

(23 Jul '13, 09:59) Frederik Ramm ♦

ok, I'm using PostGis with Osm2pgsql schema now, but it's not the nearest point, I need of all points around. look this image Here, the green square is my current location and the red square is the destination, so, How can I represent these squares on osm2pgsql schema? line, point, polygon or roads? and the main question is: how to get the squares around of my current location?

(25 Jul '13, 04:57) user

Maybe there are some hints from opensource solutions from Routing ?

permanent link

answered 22 Jul '13, 22:47

stephan75's gravatar image

stephan75
12.6k556210
accept rate: 6%

It was helpful thanks, but I didn't find anything that solved my problem.

(23 Jul '13, 03:55) user

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×290
×32

question asked: 21 Jul '13, 03:02

question was seen: 6,374 times

last updated: 25 Jul '13, 04:58

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum