de9im: DE-9IM utilities
As part of my continuing education about the theory and methods underlying Shapely, GEOS, JTS, and the OGC’s Simple Features specs, I’ve written a small package of utilities for working with DE-9IM matrices and patterns: http://bitbucket.org/sgillies/de9im/. Shapely provides the standard (these are probably my favorite OGC standards) predicates as geometry class methods:
>>> from shapely.wkt import loads
>>> p = loads('POLYGON ((1.0 0.0, 0.0 -1.0, -1.0 0.0, 0.0 1.0, 1.0 0.0))')
>>> q = loads('POLYGON ((3.0 0.0, 2.0 -1.0, 1.0 0.0, 2.0 1.0, 3.0 0.0))')
>>> p.disjoint(q)
False
>>> p.intersects(q)
True
>>> p.touches(q)
True
but what if you wanted to test whether the features touched at exactly one point only? A “side hug”, you might say. Instead of computing the intersection and checking its geometry type, you can use the de9im package to define a DE-9IM matrix pattern and test it against the relation matrix for the two features. The 0 in the pattern below requires that the intersection of the boundaries of the features be a 0-dimensional figure. In other words: a point:
>>> from de9im import pattern
>>> side_hug = pattern('FF*F0****')
>>> im = p.relate(q)
>>> print im
FF2F01212
>>> side_hug.matches(im)
True
One may also use familiarly named patterns:
>>> from de9im.patterns import touches >>> repr(touches) "DE-9IM or-pattern: 'FT*******||F**T*****||F***T****'" >>> touches.matches(im) True
Metadata
Release files for de9im 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| de9im-0.1.tar.gz | 3.3 kB | Without provenance | Details for de9im-0.1.tar.gz |
Release files / de9im-0.1.tar.gz
| Download URL | de9im-0.1.tar.gz |
|---|---|
| Size | 3.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5468625078a488a95ca0f0338c97368a82a9d08db3d8b2409949342329bb31b1
|
|
BLAKE2b-256 checksum How to use checksums |
8631f6169b1c477b037f18146299f77f01572a3ec99aeb661f66be530a9c5239
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for de9im 0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.