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.

from_shapely failing with shapely==1.8.3

See original GitHub issue

Using pygeos==0.12.0, the following test passes on shapely==1.8.2, but fails on shapely==1.8.3:

from pygeos.io import from_shapely, to_shapely
from shapely.geometry import Point


def test_to_from_shapely():
    point = Point(1, 2)
    pygeos_point = from_shapely(point)
    shapely_point = to_shapely(pygeos_point)
    assert shapely_point.x == 1
    assert shapely_point.y == 2

with

>           return lib.from_shapely(arr, **kwargs)
E           TypeError: Expected int for the __geom__ attribute, got LP_GEOSGeom_t

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jorisvandenbosschecommented, Aug 17, 2022

That commit is to fix compat with shapely 2.0, while the current regression is for 1.8.3 (and the 1.8 and 2.0 branches are completely different in shapely)

1reaction
jorisvandenbosschecommented, Aug 17, 2022

Yes, thanks to the report. I was just looking into this because it is essentially the same problem as https://github.com/geopandas/geopandas/issues/2531 and https://github.com/shapely/shapely/issues/1485.

This is a regression in 1.8.3, and will be fixed in a quick shapely 1.8.4

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - import shapely failed (win64python3.x) - Stack Overflow
Hello~when I import specific package from shapely, input the follow from shapely.geometry import Point, Polygon from ...
Read more >
Error installing shapely via pip on MacOS Big Sur and Python ...
Expected behavior and actual behavior. Would like to see Shapely install on MacOS BigSur and Python 3.9 Steps to reproduce the problem. pip ......
Read more >
python - Shapely not installing correctly - GIS Stack Exchange
Every reference I try to make from the library except from shapely import * throws the error WindowsError: [Error 126] The specified module...
Read more >
The Shapely User Manual — Shapely 2.0.0 documentation
Returns a string specifying the Geometry Type of the object in accordance with 1. >>> from shapely import Point, LineString ...
Read more >
shapely · PyPI
Manipulation and analysis of geometric objects in the Cartesian plane. ... Shapely is a BSD-licensed Python package for manipulation and analysis of planar ......
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