This release is a pre-release and may not be stable for production use.
The ebnf file is the translation of http://svn.osgeo.org/postgis/trunk/doc/bnf-wkt.txt
The bnf to ebnf conversion was guided by http://stackoverflow.com/questions/14922242/how-to-convert-bnf-to-ebnf
The generation of parse.py is as easy as: /path/to/grako Wkt.ebnf -o parse.py
parsewkt is continually tested with *Travis CI*
.. image:: https://api.travis-ci.org/cleder/parsewkt.png
:target: https://travis-ci.org/cleder/parsewkt
.. image:: https://coveralls.io/repos/cleder/parsewkt/badge.png?branch=master
:target: https://coveralls.io/r/cleder/parsewkt?branch=master
Implementation Status
=====================
Currently implemented is parsing from WKT to a __geo_interface__ compliant
dictionary for the following types:
- POINT
- LINESTRING
- POLYGON
- MULTIPOINT
- MULTILINESTRING
- MULTIPOLYGON
- GEOMETRYCOLLECTION
The parser can parse the following types but they are currently not
translated into python objects:
- COMPOUNDCURVE
- CIRCULARSTRING
- CURVEPOLYGON
- MULTICURVE
- POLYHEDRALSURFACE
- TIN
- TRIANGLE
Usage
======
>>> from parsewkt import from_wkt
>>> gc = """GEOMETRYCOLLECTION(
... POINT(99 98),
... LINESTRING(1 1, 3 3),
... POLYGON((0 0, 0 1, 1 1, 0 0)),
... POLYGON((0 0, 0 9, 9 9, 9 0, 0 0), (5 5, 5 6, 6 6, 5 5)),
... MULTIPOLYGON(((0 0, 0 9, 9 9, 9 0, 0 0), (5 5, 5 6, 6 6, 5 5)))
... )"""
>>> from_wkt(gc)
{'type': 'GeometryCollection', 'geometries': ({'type': 'Point', 'coordinates': (99.0, 98.0)}, {'type': 'LineString', 'coordinates': ((1.0, 1.0), (3.0, 3.0))}, {'type': 'Polygon', 'coordinates': (((0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (0.0, 0.0)),)}, {'type': 'Polygon', 'coordinates': (((0.0, 0.0), (0.0, 9.0), (9.0, 9.0), (9.0, 0.0), (0.0, 0.0)), ((5.0, 5.0), (5.0, 6.0), (6.0, 6.0), (5.0, 5.0)))}, {'type': 'MultiPolygon', 'coordinates': ((((0.0, 0.0), (0.0, 9.0), (9.0, 9.0), (9.0, 0.0), (0.0, 0.0)), ((5.0, 5.0), (5.0, 6.0), (6.0, 6.0), (5.0, 5.0))),)})}
>>> tri = """TRIANGLE((0 0 0,0 1 0,1 1 0,0 0 0))"""
>>> from_wkt(tri)
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/.../parsewkt/parsewkt/wkt.py", line 307, in from_wkt
raise NotImplementedError
NotImplementedError
Download
********
Metadata
Release files for parsewkt 0.1dev
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 |
|---|---|---|---|---|
| parsewkt-0.1dev.tar.gz | 11.9 kB | Without provenance | Details for parsewkt-0.1dev.tar.gz |
Release files / parsewkt-0.1dev.tar.gz
| Download URL | parsewkt-0.1dev.tar.gz |
|---|---|
| Size | 11.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
25e9c446632d9fc6b209256ba780eff0b25c9a98691dc7dcea03a7cfe2e50b3a
|
|
BLAKE2b-256 checksum How to use checksums |
458acca913105036937bcf9f697a763d0146ed338caf417bf050c3eee41f3cd7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for parsewkt 0.1dev
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.