question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Returns null geometries

See original GitHub issue

Hello,

From not I was only using Overpass API Python wrapper for querying nodes. I would like to use it now for querying ways and I got back only null geometries.

Here my code:

query_text = 'area(3602134786)->.a;(nwr[leisure~"^(park)$"](area.a););'
api = overpass.API()
result = api.get(query_text)

And an extract of what I got returned:

{"features": [
{"geometry": null,
"id": 51876557,
"properties": {"barrier": "fence", "leisure": "park", "name": "Parc Wilson"},
"type": "Feature"
},
{"geometry": null,
"id": 51925873,
"properties": {"barrier": "fence", "leisure": "park", "name": "Parc Napol\u00e9on", "ref:FR:FANTOIR": "576721870A"},
"type": "Feature"
},
{"geometry": null,
"id": 65283729,
"properties": {"leisure": "park", "name": "Square Robert Schuman", "source": "cadastre-dgi-fr source : Direction G\u00e9n\u00e9rale des Imp\u00f4ts - Cadastre. Mise \u00e0 jour : 2010"},
"type": "Feature"
}, 
...
], "type": "FeatureCollection"}

When I do the exact same request using Python librairy requests, I actually got non null geometries:

import requests
import json

overpass_url = "http://overpass-api.de/api/interpreter"
query_text = 'area(3602134786)->.a;(nwr[leisure~"^(park)$"](area.a););'

response = requests.get(overpass_url, 
                        params={'data': query_text})

data = response.json()

Any idea of what is going wrong?

Thanks for your help,

Pauline

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
paumilletcommented, Dec 20, 2019

I actually found the trick after having spent days in the docs and the code: You need to add the parameter verbosity="geom" when passing your request as in the following example.

query_text = 'area(3602134786)->.a;(nwr[leisure=park](area.a););'
api = overpass.API()
result = api.get(query_text, responseformat="geojson", verbosity="geom")

Hope it helps!

1reaction
frodrigocommented, Dec 9, 2019

The conversion to geojson of relations and areas are not supported.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Missing and empty geometries - GeoPandas
Empty geometries are actual geometry objects but that have no coordinates (and thus also no area, for example). They can for example originate...
Read more >
What does it mean by NULL geometry of a shapefile in ArcGIS?
A shape type of 0 indicates a null shape, with no geometric data for the shape. Eachfeature type (point, line, polygon, etc.) supports...
Read more >
How To: Create geometry for a feature with null ... - Esri Support
This article describes how to create geometry for a feature with null geometry using the Replace Geometry tool in ArcGIS Pro. Procedure. Add...
Read more >
Null Geometry ShapeFiles · Issue #326 · Riverscapes/gcd
Null geometries occur when a ShapeFile (can be point, line or polygon) has a record in the attribute table but not corresponding geometry....
Read more >
Null (geometry Data Type) - SQL Server | Microsoft Learn
Syntax. Copy. Null. Note · Return Types. SQL Server type: geometry. CLR type: SqlGeometry. Remarks · Examples. The following example retrieves a ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found