shapely / shapely/shapely

DOC: include explanation of non-noded intersections in documentation of polygonize

Open
#1,736 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs discussion
Dominant language
Python
Stars
4.5k
Forks
631
Avg merge
1d 11h
Merged PRs (30d)
10

Description

I spent some time today banging my head against the wall trying to figure out how to ensure that polygonize returns all expected polygons and found out that non-noded intersections (non-planar network like briges or tunnels intersecting streets on the ground) very often cause a trouble. And then I found out how to fix that.

The whole thing is described here but the key trick is to use node before polygonize to ensure the proper result.

collection = shapely.GeometryCollection(linestrings_array)  # combine to a single object
noded = shapely.node(collection)  # add missing nodes
polygonized = shapely.polygonize(noded.geoms)  # polygonize based on an array of nodded parts

I was wondering if it shouldn't be part of the documentation so others don't have to through the same process as I did. Happy to do a PR but wanted to check first.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the polygonize documentation and the linked explanation of non-noded intersections. Add guidance that non-planar networks can omit polygons and document the node-before-polygonize approach shown in the issue; done when users can find and follow this example.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.