This is a static archive of our old OSM Help Site. Please post any new questions and answers at community.openstreetmap.org.

find max speed of road using lat lon

0

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%


One Answer:

0

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

way maxspeed text linear

and it added maxspeed to each record.

answered 06 Aug '17, 13:26

aitizazk's gravatar image

aitizazk
217710
accept rate: 0%