Comments (3)
Revert Shapely to 1.8.5 and Numpy to 1.23.4
Should work.
from pyrosm.
Thank you very much for your help!
It solved this issue but I have now the following error:
....\ox\python.exe test_osmnx.py
....\ox\lib\site-packages\geopandas_compat.py:123: UserWarning: The Shapely GEOS version (3.11.1-CAPI-1.17.1) is incompatible with the GEOS version PyGEOS was compiled with (3.10.4-CAPI-1.16.2). Conversions between both will be slow.
warnings.warn(
Downloaded Protobuf data 'Helsinki_region.osm.pbf' (34.99 MB) to:
'C:\Users....\AppData\Local\Temp\pyrosm\Helsinki_region.osm.pbf'
Traceback (most recent call last):
File "....\test_osmnx.py", line 14, in
buildings_A = osm.get_buildings()
File "....\ox\lib\site-packages\pyrosm\pyrosm.py", line 265, in get_buildings
gdf = get_building_data(
File "....\ox\lib\site-packages\pyrosm\buildings.py", line 47, in get_building_data
gdf = prepare_geodataframe(
File "pyrosm/frames.pyx", line 134, in pyrosm.frames.prepare_geodataframe
cpdef prepare_geodataframe(nodes, node_coordinates, ways,
File "pyrosm/frames.pyx", line 147, in pyrosm.frames.prepare_geodataframe
relation_gdf = prepare_relation_gdf(node_coordinates, relations, relation_ways, tags_as_columns)
File "pyrosm/frames.pyx", line 123, in pyrosm.frames.prepare_relation_gdf
relations = prepare_relations(relations, relation_ways,
File "pyrosm/relations.pyx", line 175, in pyrosm.relations.prepare_relations
cpdef prepare_relations(relations, relation_ways, node_coordinates, tags_to_keep):
File "pyrosm/relations.pyx", line 176, in pyrosm.relations.prepare_relations
return _prepare_relations(relations, relation_ways, node_coordinates, tags_to_keep)
File "pyrosm/relations.pyx", line 165, in pyrosm.relations._prepare_relations
relation_records = get_relations(relations, relation_ways, node_coordinates)
File "pyrosm/relations.pyx", line 142, in pyrosm.relations.get_relations
geometry = fix_geometry(geometry)
File "pyrosm/geometry.pyx", line 25, in pyrosm.geometry.fix_geometry
fix_candidate = geometry.buffer(0)
File "....\ox\lib\site-packages\shapely\geometry\base.py", line 636, in buffer
return geom_factory(self.impl['buffer_with_params'](self, params, distance))
File "....\ox\lib\site-packages\shapely\topology.py", line 81, in call
return self.fn(this._geom, *args)
OSError: exception: access violation reading 0x0000000000055C98
The source code is what I found as example but I put here so that you check that I made no modification:
import osmnx as ox
from shapely.geometry import box
from pyrosm import OSM, get_data
import time
Parse buildings with Pyrosm and time it
start_t = time.time()
A PBF data for Helsinki Region (~34 MB)
will be downloaded automatically to TEMP with Pyrosm
pbf_path = get_data("helsinki_region_pbf")
osm = OSM(pbf_path)
buildings_A = osm.get_buildings()
print("=====================================\nPYROSM\n=====================================")
print(f"Parsing buildings with Pyrosm lasted {round(time.time() - start_t, 1)} seconds.")
print(f"Number of buildings in the Pyrosm dataset: {len(buildings_A)}")
print("\n=====================================\n")
Parse buildings from the same region using OSMnx and time it
start_t = time.time()
data_extent = box(*buildings_A.total_bounds)
buildings_B = ox.footprints_from_polygon(polygon=data_extent,
footprint_type="building",
retain_invalid=False,
)
print("=====================================\nOSMNX\n=====================================")
print(f"Parsing buildings with OSMnx lasted {round(time.time() - start_t, 1)} seconds.")
print(f"Number of buildings in the OSMnx dataset: {len(buildings_B)}")
print("\n=====================================\n")
from pyrosm.
This is now fixed in the new release pyrosm v0.6.2 which uses by default Shapely 2.0. See #214 . Try updating pyrosm
with pip (installing from conda-forge is soon available as well).
from pyrosm.
Related Issues (20)
- ModuleNotFoundError: No module named 'pyrosm_proto' HOT 1
- Make pyrosm compatible with newer numpy and shapely version. HOT 13
- Question: regarding Documentation/code
- AttributeError: module 'numpy' has no attribute 'float' HOT 6
- pip install pyrosm fails v0.6.1. HOT 3
- AttributeError: module 'shapely.geos' has no attribute 'lgeos' HOT 2
- Members of relations do not appear in the columns HOT 1
- Error message when trying to download cycling network for Poznan HOT 1
- Unix to Datetime conversion does not work
- Update Python environments
- custom_filter get_pois not working with value True HOT 6
- Building geometry mismatch issue
- Is it possible to export the filtered OSM to OSM/XODR?
- Writing OSM PBF files?
- Error when modifying the example code for Basic Usage:Read street networks
- loading multipolygon
- elevation data? HOT 1
- Is there a method to get all objects?
- ID in building tags overwriting way ID HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyrosm.