GithubHelp home page GithubHelp logo

Comments (3)

p4r4xor avatar p4r4xor commented on July 28, 2024

Revert Shapely to 1.8.5 and Numpy to 1.23.4
Should work.

from pyrosm.

Picard2200 avatar Picard2200 commented on July 28, 2024

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.

HTenkanen avatar HTenkanen commented on July 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.