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.

DOC: Enhance description of STRtree to indicate that geometries are indexed and queried based on extents

See original GitHub issue

Expected behavior and actual behavior.

STRTree returns a collision where there is none. A minimal case: image

Steps to reproduce the problem.

from shapely import wkt
from shapely.strtree import STRtree

poly_query = wkt.loads('POLYGON ((58.27 44.72, 56.96 47.18, '
                       '58.47 47.98, 59.78 45.52, '
                       '58.27 44.72))')
poly_in_tree = wkt.loads('POLYGON ((57.94 44.73, 57.94 44.42, '
                         '56.02 44.42, 56.02 44.73, '
                         '57.94 44.73))')

query_tree = STRtree([poly_in_tree])
collide_objects = query_tree.query_geoms(poly_query)

assert not poly_in_tree.intersects(poly_query)
assert 0 == len(collide_objects)

Operating system

Windows

Shapely version and provenance

Shapely 1.8.2 via conda.

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
brendan-wardcommented, Nov 23, 2022

axis-aligned-bounding-box

correct. We can try to make the description of STRtree more clear in this respect.

0reactions
adishavitcommented, Nov 23, 2022

I’m using Shapely 1.8, so I have to do the filtering manually.

Read more comments on GitHub >

github_iconTop Results From Across the Web

DOC: Improve STRtree docstrings #1626 - GitHub
Resolves #1622 Improves STRtree docstrings in an attempt to make it more clear that the tree is based on 2-dimensional bounding boxes.
Read more >
STRTree — pygeos documentation - Read the Docs
A query-only R-tree created using the Sort-Tile-Recursive (STR) algorithm. For two-dimensional spatial data. The tree is constructed directly at initialization.
Read more >
Shapely Documentation - Read the Docs
list of geometry objects to the STRtree constructor to create a spatial index that you can query with another geometric object.
Read more >
R-tree Spatial Indexing with Python - Geoff Boeing
First we have our GeoDataFrame (called gdf) create an R-tree spatial index for its geometry. Then we intersect this index with the bounding ......
Read more >
Spatial Indexes Overview - SQL Server | Microsoft Learn
A spatial column is a table column that contains data of a spatial data type, such as geometry or geography. Tip. SQL Server...
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