[Talk-ca] Getting the speed limit for a given latitude/longitude
René Fournier
m5 at renefournier.com
Wed Aug 22 01:16:10 BST 2012
Hi Richard et al,
So, I've used osm2pgsql to import the canada.osm file into PostgreSQL:
osm2pgsql --latlong -d speed_limits_canada canada.osm -U postgres
Seems to have done the job:
Node stats: total(132433150), max(1873380872) in 1150s
Way stats: total(8281053), max(176854853) in 1235s
Relation stats: total(103361), max(2363373) in 742s
Writing way (8281k)
Writing relation (103344)
Committing transaction for planet_osm_point
Committing transaction for planet_osm_roads
Committing transaction for planet_osm_line
Sorting data and creating indexes for planet_osm_point
Sorting data and creating indexes for planet_osm_roads
Sorting data and creating indexes for planet_osm_line
Committing transaction for planet_osm_polygon
Sorting data and creating indexes for planet_osm_polygon
Indexes on planet_osm_roads created in 99s
Completed planet_osm_roads
Indexes on planet_osm_point created in 564s
Completed planet_osm_point
Indexes on planet_osm_line created in 808s
Completed planet_osm_line
Indexes on planet_osm_polygon created in 819s
Completed planet_osm_polygon
Osm2pgsql took 4972s overall
Not being familiar with OSM at all, I was wondering, can someone suggest the simplest way (query) to get the max speed of the nearest road to a given point?
On 2012-08-21, at 4:22 PM, Richard Weait wrote:
> On Tue, Aug 21, 2012 at 4:26 PM, René Fournier <m5 at renefournier.com> wrote:
>> Looking for suggestions...
>>
>> I need to create a web service that, given a latitude/longitude coordinate that lies on a major road or highway, returns a maximum speed limit. Looking at services like http://www.itoworld.com/map/35#fullscreen, it's clear that much of the data is there. What's the best way to go about this? Anyone try it before?
>
> How often do you want to request the data?
>
> 1) Build a local DB.
> 2) request the maxspeed from the highway nearest the stated coordinates.
>
> For extra marks, you might want to build in some logic and some persistence.
>
> Seems pretty straightforward.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/talk-ca/attachments/20120821/c72a188e/attachment-0001.html>
More information about the Talk-ca
mailing list