ENH: Add example or implement dissolve of contiguous or otherwise related geometries
See original GitHub issueAn example was added to networkx
(https://github.com/networkx/networkx/pull/4381) that may be more appropriate here, either via implementation in the API or as an example (potentially as a more advanced example, it is a little complex). It certainly has room to be improved further.
This was also raised in a comment on #1568
This could leverage #1674 to capitalize on vectorized spatial relations between two GeoSeries - which in this case would be the same GeoSeries against itself. The important part is that it uses a spatial index followed by the predicate operation.
In early testing, the linked example appears faster than PySAL Queen
contiguity.
Ideally, this would permit the user to specify the spatial relationship (within reason). The linked example uses intersects
, but it could also be expanded to touches
, overlaps
, etc.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (6 by maintainers)
Probably related is this PR https://github.com/pysal/libpysal/pull/335 implementing libpysal’s
fuzzy_contiguity
based onquery_bulk
exposing predicate. Therefore you can do the following to dissolve based on predicate (+ some buffer options)I would not add it to our API but it may be a nice set of examples.
@ljwolf I have a WIP version of Queen somewhere which uses pygeos to get coordinates (instead of looping) which brings reasonable speedups esp. on large gdfs. I’ll dig it out.