Difference between revisions of "OpenStreetMap"

From GRASS-Wiki
Jump to: navigation, search
(int tOSM vs. GRASS topology)
(Expample)
Line 30: Line 30:
 
The roundabout_before.png image represents roundabout after the import of the OSM shapefile from geofabrik. You can see that there is only one category number 917, it means that the roundabout circle is just one segment and grass does not see all connections to other lines, because they are not on the starting/end node of the circle.
 
The roundabout_before.png image represents roundabout after the import of the OSM shapefile from geofabrik. You can see that there is only one category number 917, it means that the roundabout circle is just one segment and grass does not see all connections to other lines, because they are not on the starting/end node of the circle.
  
[[Image:01 roundabout before.png‎|left|700px|thumb|v.in.ogr output]]  
+
[[Image:01 roundabout before.png‎|center|700px|thumb|v.in.ogr output]]  
  
 
After the  application of v.split you get too many one segment lines. It is clear form roundabout_split.png.
 
After the  application of v.split you get too many one segment lines. It is clear form roundabout_split.png.
  
[[Image:02 roundabout split.png‎|left|700px|thumb|v.split output]]
+
[[Image:02 roundabout split.png‎|center|700px|thumb|v.split output]]
  
 
{{cmd|version=71|v.build.polylines}} gives you what you need. All lines starts/ends on the intersections with other lines.
 
{{cmd|version=71|v.build.polylines}} gives you what you need. All lines starts/ends on the intersections with other lines.
  
[[Image:03 roundabout after.png|left|700px|thumb|v.build.polylines output]]
+
[[Image:03 roundabout after.png|center|700px|thumb|v.build.polylines output]]
  
 
There is another possibility  to use {{cmd|version=71|v.clean}} tool=break but if you have e. g. bridge then v.clean connects it to the roads going bellow it which is incorrect. The above described approach does not split the bridge there. See vclean,png and vclean_difference.png.
 
There is another possibility  to use {{cmd|version=71|v.clean}} tool=break but if you have e. g. bridge then v.clean connects it to the roads going bellow it which is incorrect. The above described approach does not split the bridge there. See vclean,png and vclean_difference.png.
  
[[Image:Vclean difference.png|left|700px|thumb|Output of v.split -> v.build.polylines]]
+
[[Image:Vclean difference.png|center|700px|thumb|Output of v.split -> v.build.polylines]]
[[Image:Vclean.png|left|700px|thumb|Output of v.clean tool=break]]  
+
[[Image:Vclean.png|center|700px|thumb|Output of v.clean tool=break]]  
  
 
=== See also ===
 
=== See also ===

Revision as of 14:28, 6 March 2016

OSM Homepage: http://www.openstreetmap.org/

Import

Conversion with Mapnik to raster tiles may work, but be very careful about projection issues, typical online web map tiles are not appropriate for GIS import.

Data as shapefiles

Get data from here:

Then import with v.in.ogr

Data from WMS

  • Web Map Service (WMS) for Europe: GetCapabilities to access the WMS
  • No free/open world-wide server known - Badly needed

Then import with r.in.wms

OSM vs. GRASS topology

OSM topological model is different to GRASS topological model. OSM topologically correct connections of the lines can be on all nodes of the line. Unlike OSM, GRASS allows to connect lines only on their starting/end nodes.Therefore after the import it is needed to split lines into the smallest segments by "v.split vertices=2". However after application of the v.split, there are too many lines and some of them are not necessary. Module v.build.polylines cats=same merges the extra lines into single polyline.

Expample

The roundabout_before.png image represents roundabout after the import of the OSM shapefile from geofabrik. You can see that there is only one category number 917, it means that the roundabout circle is just one segment and grass does not see all connections to other lines, because they are not on the starting/end node of the circle.

v.in.ogr output

After the application of v.split you get too many one segment lines. It is clear form roundabout_split.png.

v.split output

v.build.polylines gives you what you need. All lines starts/ends on the intersections with other lines.

v.build.polylines output

There is another possibility to use v.clean tool=break but if you have e. g. bridge then v.clean connects it to the roads going bellow it which is incorrect. The above described approach does not split the bridge there. See vclean,png and vclean_difference.png.

Output of v.split -> v.build.polylines
Output of v.clean tool=break

See also