0

Hi,

I'm mapping areas for fire-stations and we use a "tactical grid" over our map. I want to get all street names from the fire-service area and then create a list saying eg:

  • Nelson Street - A5
  • Duty Road - B6

where A5 is a square in our tactical grid and so on. I've a routine, converting GPS Lat and Long to our grid system.

The problem is that when I export OSM file (using eg this: https://www.openstreetmap.org/export#map=14/51.4898/-0.0882&layers=N )I get a file where the "real node" have their GPS values, but streets has only the "nd" reference of their node, without the GPS values.

Of course, I can ask OSM server for Lat and Long for each "nd", one bye one using : http://api.openstreetmap.org/api/0.6/node/2639002010 but it will take time: I need the GPS values for each point, in case of a street overlapping more than one square of our grid;

How can I get, in one call, GPS values of all "nd"? Is-it possible to get an OSM file, directly with them, or is there a way to send a "pack" of "nd" references to the server and get pack in one call, all Lat and Long fo each of them?

Thanks a lot

asked 29 Dec '14, 18:06

ANSB's gravatar image

ANSB
11113
accept rate: 0%


One Answer:
4

The export you mention already contains the lat/lon for all nodes. If a way says

<nd ref="1234" />

then there will be a

<node id="1234" lat="1.234" lon="2.345" ... />

later in the file.

You might however be approaching this in a way that causes you more headache and the OSM server more load than necessary. You could simply download all the data for your region of interest, import it into PostGIS with osm2pgsql (use the -l flag) and then with relative ease query the database for all roads that are inside a certain rectangle - with a query like

SELECT name 
FROM planet_osm_line
WHERE highway is not null AND
   way && ST_MakeBox2D(
       ST_Point(lon, lat), -- place lower left coordinates of box here
       ST_Point(lon, lat)) -- place upper right coordinates of box here

Another alternative is using the Overpass API to return all highway-type ways in a given bounding box.

permanent link

answered 29 Dec '14, 18:51

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
73.3k866641137
accept rate: 24%

Thanks Frederik! I've tried this but made a mistake for my "search" so I believed these were other nodes! Thanks again!

(29 Dec '14, 19:41) ANSB

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:

×160
×83
×45
×36
×3

question asked: 29 Dec '14, 18:06

question was seen: 6,820 times

last updated: 29 Dec '14, 19:41

powered by OSQA