mvexel / overpass-api-python-wrapper

Python bindings for the OpenStreetMap Overpass API
Apache License 2.0
368 stars 90 forks source link

Write result to file #103

Closed antifa-ev closed 6 years ago

antifa-ev commented 6 years ago

How can I dump the result to a GeoJSON file?

When there are nested FeatureCollections the output via geojson.dump is faulty!

mvexel commented 6 years ago

Hey, let's solve this. Can you give an example?

mvexel commented 6 years ago

The example you link to is not valid GeoJSON:

{
  "type": "FeatureCollection", 
  "features": {
    "type": "FeatureCollection", 
    "features": [
      {
        "geometry": {
          "type": "Polygon", 
          "coordinates": [
            [

            ]
          ]
        }, 
        "type": "Feature", 
        "properties": {
          "gval": 1.0, 
          "hectares": 0.218681933167, 
          "xid": 0, 
          "id": 1.0, 
          "area": 2186.81933167
        }
      }
    ]
  }
}

has a dictionary as the value for features and as far as I know this is not valid according to GeoJSON spec.

mvexel commented 6 years ago

Closing this because no more feedback for some time. Feel free to reopen @antifa-ev if you feel your question was not answered!