0

I have a road database in .osm.pbf format; I want, for a long list of GPS points, to classify whether they fall on (with a margin of, say, 20m)

  • Highway: motorway, trunk, motorway_link, trunk_link
  • Intercity: primary, secondary, tertiary, primary_link, secondary_link, tertiary_link
  • Other

I'm open to use any tool that will do the job - arcpy, spatialite, postgis, others - but I'm not deeply familiar with any of these.

1

You may perform this classification using QGIS:

  1. Download and Install QGIS
  2. Add OSM and GPS layer into QGIS (usign Add Vector Layer button) and convert these both to shapefile (right click layer and select Save As) (make sure they are in the same CRS)
  3. Run Near analysis tool to pull the nearest road type feature and attributes into the point shapefile

See this q/a for Near analysis tool options within Q

What QGIS tool or plugin is equivalent to the ESRI "Near" tool?

  • Is this automatable, and will it work if I have a lot of points (initial batch would be +/- 12M points)? – retorquere Dec 8 '17 at 20:42
  • Definitely, put the point and line layers in some sort spatial database (spatiallite, or PostgreSQL/PostGIS) that has spatial indexes and you can automate it using python pyqgis module. There are several python methods to get closest feature within their vector geometry object or also straight PostGIS SQL queries. – artwork21 Dec 8 '17 at 22:05
  • Super -- I already have the road network in a spatialite DB, so if you could point me to the pyqgis method that would get me the nearest road I'd be set! – retorquere Dec 8 '17 at 22:19
  • You may be able to use nearestPoint, qgis.org/api/… – artwork21 Dec 9 '17 at 20:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.