+
Skip to content

StreetProfile shall warn if CRS is geographic #369

@adhamenaya

Description

@adhamenaya

Describe the problem

I am following the sample source code on this link: Simplified detection of urban types . And after updating GeoPandas (0.11.0) and GDAL (3.5.0) packages, I started getting this error:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Input In [4], in <cell line: 1>()
----> 1 profile = momepy.StreetProfile(streets, buildings)

File ~/opt/anaconda3/envs/PythonEnv/lib/python3.9/site-packages/momepy/dimension.py:590, in StreetProfile.__init__(self, left, right, heights, distance, tick_length, verbose)
    587         ticks.append([line_end_1, pt])
    588         ticks.append([line_end_2, pt])
--> 590 ticks = pygeos.linestrings(ticks)
    592 inp, res = right.sindex.query_bulk(ticks, predicate="intersects")
    593 intersections = pygeos.intersection(ticks[inp], right.geometry.values.data[res])

File ~/opt/anaconda3/envs/PythonEnv/lib/python3.9/site-packages/pygeos/decorators.py:80, in multithreading_enabled.<locals>.wrapped(*args, **kwargs)
     78     for arr in array_args:
     79         arr.flags.writeable = False
---> 80     return func(*args, **kwargs)
     81 finally:
     82     for arr, old_flag in zip(array_args, old_flags):

File ~/opt/anaconda3/envs/PythonEnv/lib/python3.9/site-packages/pygeos/creation.py:119, in linestrings(coords, y, z, indices, out, **kwargs)
    117 coords = _xyz_to_coords(coords, y, z)
    118 if indices is None:
--> 119     return lib.linestrings(coords, out=out, **kwargs)
    120 else:
    121     return simple_geometries_1d(coords, indices, GeometryType.LINESTRING, out=out)

ValueError: linestrings: Input operand 0 does not have enough dimensions (has 1, gufunc core with signature (i, d)->() requires 2)

Steps to reproduce

import geopandas
import libpysal
import momepy
import osmnx
import pandas

place = 'Znojmo, Czechia'

buildings = osmnx.geometries.geometries_from_place(place, tags={'building':True})

osm_graph = osmnx.graph_from_place(place, network_type='drive')
#osm_graph = osmnx.projection.project_graph(osm_graph, to_crs=local_crs)
streets = osmnx.graph_to_gdfs(
    osm_graph, 
    nodes=False, 
    edges=True,
    node_geometry=False, 
    fill_edge_geometry=True
)

profile = momepy.StreetProfile(streets, buildings)

Versions of your packages

GeoPandas=0.11.0
GDAL=3.5.0
momepy=0.5.3
libpysal=4.6.2
osmnx=1.2.1

Your operating system

macOS Monterey 12.4

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载