I migrated osm data using osm2pgsql. I am using the following query to get road information from lat lon values.

 SELECT 
 osm_id,
 highway,
 name,
 ref, 
 ST_X(ST_ClosestPoint(ST_Transform(r.way, 4326), point.geom)),      
 ST_Y(ST_ClosestPoint(ST_Transform(r.way, 4326), point.geom)),
 ST_Distance_Sphere(ST_ClosestPoint(ST_Transform(r.way, 4326), point.geom), point.geom)
FROM 
  planet_osm_roads r,
  (Select ST_SetSRID(ST_MakePoint(-104.718649, 39.201070), 4326) as geom) point
ORDER BY 7 ASC
LIMIT 1;

where -104.718649, 39.201070 are lon and lat values. Now I also need the maxspeed of that road. how can i get the maxspeed of a road given lat lon values?

asked 27 Jul '17, 13:49

aitizazk's gravatar image

aitizazk
217710
accept rate: 0%


I just had to add the following line to the style file

way maxspeed text linear

and it added maxspeed to each record.

permanent link

answered 06 Aug '17, 13:26

aitizazk's gravatar image

aitizazk
217710
accept rate: 0%

Your answer
toggle preview

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:

×225
×126
×40

question asked: 27 Jul '17, 13:49

question was seen: 1,450 times

last updated: 06 Aug '17, 13:26

powered by OSQA