NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

2
1

Hi,

I use the OverpassAPI to extract some data. Exporting them via the webinterface as geoJSON works fine but when I use an OverpassQL-link (example below) I receive a JSON-file with a different structure. How can I get a geoJSON-file with this link?

http://overpass-api.de/api/interpreter?data=[out:json];node(51.69,10.48,51.73,10.56)["highway"="street_lamp"];out;;

regards

asked 09 Jul '13, 12:34

Ogmios's gravatar image

Ogmios
766202639
accept rate: 25%

How does the structure differ? Is it a valid GeoJSON file? Did you remove the duplicated semicolon at the end of your link?

(09 Jul '13, 13:02) scai ♦

Overpass returns a JSON format that is a direct representation of OSM data. This is not GeoJSON, because GeoJSON doesn't fit the OSM data structure.

In particular, in GeoJSON everything has a geometry, and topological incidence (like two ways sharing a node) is not represented directly. Also, GeoJSON differentiates between simple polygons and non-closed ways, which OSM does not (or again, not directly).

For these reasons, you need a conversion from OSM data to GeoJSON, and this is what Overpass Turbo does.

permanent link

answered 13 Jul '13, 10:24

Roland%20Olbricht's gravatar image

Roland Olbricht
6.7k36489
accept rate: 36%

I have looked at the code that Overpass Turbo uses, in the hope that I could adapt the OSM4Leaflet.js code to easily add standard overpass JSON queries to my map.

This is the sort of thing I'd ideally like to be able to do:

var jsonLayer = new L.OSM4Leaflet(json).addTo(map);

Unfortunately I can't understand the complexities of the code used by Overpass Turbo. Could anyone help me out? It would be very useful to have a simple method be generally known.

permanent link

answered 06 Aug '13, 15:41

Tom%20Chance's gravatar image

Tom Chance
16
accept rate: 0%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×85
×36
×28

question asked: 09 Jul '13, 12:34

question was seen: 6,512 times

last updated: 25 Apr '14, 14:17

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum