1

I just want to convert osm data to geojson where it is pretty simple with node and way tags of osm data, but relation which is giving complex can't find the logic to convert osm relation to geojson format especially how to form coordinates parameter of geojson based on their roles (ex. Inner, outer, admin_centre, riverbank, side_stream, main_stream, from, via, to, forward, backward, stop_entry_only, stop_exit_only, and platform_exit_only).

As simple, how to form relation member's latitude and longitude in coordinates parameter of geojson.

I have tried many documentation but no logics or code found in java and python.

In python: https://pypi.org/project/osm2geojson/
OSM Official: https://wiki.openstreetmap.org
geojson Official: https://geojson.org/
Sample data: https://download.geofabrik.de/asia/maldives-latest.osm.bz2 https://download.geofabrik.de/asia/bhutan-latest.osm.pbf

But no luck

I have tried in java and python but reason is I could not find the logic behind the conversion of the relation tags from osm to geojson

I am expecting the logic behind the conversion of the relation tags from osm to geojson and sample code for that.

MyNameIsCaleb
  • 4,409
  • 1
  • 13
  • 31
jayendran S
  • 29
  • 1
  • 5
  • Maybe this Overpass turbo example helps: https://overpass-turbo.eu/s/Jcl. Click run, then export, save as GeoJSON. Take a look at the result. You can change the original query to see how other OSM relations are exported to GeoJSON. Note that there is not just one "correct" way for converting OSM data to GeoJSON. – scai May 21 '19 at 07:12
  • thanks for the response. but i need a logic of geojson structure formation of geojson or code snippet. but overpass-turbo.eu/s/Jcl is simple osm query tool.... – jayendran S May 22 '19 at 07:14
  • Sorry, I don't understand what "logic of geojson structure formation of geojson" is supposed to mean. Take a look at https://wiki.openstreetmap.org/wiki/GeoJSON which lists various tools for converting OSM data to GeoJSON. – scai May 22 '19 at 07:39

1 Answers1

0

The GeoJSON page in the OSM Wiki lists various tools for converting OSM data to GeoJSON:

The above mentioned osmtogeojson is used by overpass-turbo for creating GeoJSON exports.

scai
  • 20,297
  • 4
  • 56
  • 72