aspectumapp / osm2geojson

Convert OSM and Overpass XML/JSON to GeoJSON
MIT License
97 stars 15 forks source link

Troubles with xml2geojson #23

Closed valluzzi closed 2 years ago

valluzzi commented 2 years ago

Hi, I have some troubles with the following query:

from osm2geojson import *
query="""[out:xml][timeout:60];
(
  // query part for: "building"
  way["building"](poly:"44.0602 12.5646 44.0608 12.5646 44.0612 12.5650 44.0595 12.5693 44.05860 12.5656");
);
out geom;
"""
xml = overpass_call(query)
features = xml2geojson(xml, filter_used_refs=False)
print(features)

the output is NO features while in the xml there are 8 features and also https://overpass-turbo.eu/ can see the buildings.

Am I doing something wrong?

Thank you for osm2geojson!

rapkin commented 2 years ago

Hi! I tested your example with last version and it works as expected.

image

image

valluzzi commented 2 years ago

That's true!, I cant understand why this part of code doesnt worked in another section of my code. I am sorry for the false alarm. thank you again.

rapkin commented 2 years ago

Oh, it's interesting. Maybe some conflict under the hood (geos used in Shapely and GDAL)

valluzzi commented 2 years ago

Oh, it's interesting. Maybe some conflict under the hood (geos used in Shapely and GDAL)

Yes but only on Windows (python 3.7.9 ) (may be It is fault of the unofficial GDAL https://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal. I have tried this on colab (Ubuntu ) and it works perfectly

cgohlke commented 2 years ago

I think this is due to an old GEOS DLL. I updated the shapely, gdal, and basemap wheels at https://www.lfd.uci.edu/~gohlke/pythonlibs to use the same geos-3.9.1 DLL. Your code works now. If you mix those wheels with binaries from pypi, conda, or osgeo, you might still run into DLL conflicts.