0

I'm new to openstreet maps and the geojson format.

I'm drawing buildings and roads using GeoJson. A Building is represented as a Polygon, thus i can create the proper geometry as needed, but a Road is represented as a LineString, thus i only get to draw them as lines, and i lack information about the width of it.

Drawing roads with different widths from GeoJSON using C#? seems to imply there's a way to get the width of a road using GeoJson (and also, the look of the roads as shapes instead of lines as the link's picture is what i'm looking forward in my project).

(image borrowed from above link's) image took from above link's

It's there in the GeoJson format data for road width/shape I'm failing to find in the GeoJson file ?

If not, it's there any sort of convention for road width i can use to draw my roads?, like estimated size

To be clear, i'm not trying to get the very exact shape of any given road, but i would like to draw roads as shapes just as the picture when possible, or at the very least understand how i can come close to achieve that.

1 Answer 1

3

As far as I can tell, OSM data does not define the road width, but there is a property named "highway" that describes the road type. You can use this property to symbolize different road types with different widths. For certain features, there may also be a lanes key, which you can use to get an idea of the actual road width. (But I would suspect that width of roads that have the same number of lanes can vary considerably).

Here is a geojson extract from some OSM data, showing three features with highway types of "cycleway", "residential" and "footway", respectively:

{
"type": "FeatureCollection",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },

"features": [
{ "type": "Feature", "properties": { "osm_id": "88380991", "name": "Max-Friedlaender-Bogen", "highway": "cycleway", "waterway
": null, "aerialway": null, "barrier": null, "man_made": null, "other_tags": "\"bicycle\"=>\"designated\",\"motor_vehicle\"=>
\"no\",\"smoothness\"=>\"good\",\"surface\"=>\"asphalt\"" }, "geometry": { "type": "LineString", "coordinates": [ [ 11.543787
5, 48.140514 ], [ 11.5435027, 48.140536 ] ] } },
{ "type": "Feature", "properties": { "osm_id": "88380992", "name": "Max-Friedlaender-Bogen", "highway": "residential", "water
way": null, "aerialway": null, "barrier": null, "man_made": null, "other_tags": "\"bicycle\"=>\"yes\",\"smoothness\"=>\"good\
",\"surface\"=>\"asphalt\"" }, "geometry": { "type": "LineString", "coordinates": [ [ 11.542084, 48.1405486 ], [ 11.5420549, 
48.1403008 ] ] } },
{ "type": "Feature", "properties": { "osm_id": "128929092", "name": null, "highway": "footway", "waterway": null, "aerialway"
: null, "barrier": null, "man_made": null, "other_tags": "\"access\"=>\"permissive\",\"bicycle\"=>\"permissive\",\"motor_vehi
cle\"=>\"no\",\"tracktype\"=>\"grade1\"" }, "geometry": { "type": "LineString", "coordinates": [ [ 11.5424447, 48.1405879 ], 
[ 11.5424322, 48.1405289 ] ] } }, ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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