esrijson
Introduction
This module is meant to build a bridge between GDAL __geo_interface__ property via Shapely.
There is no concept of GeometryCollection in esrijson syntax, so there is only a limited support for this concept. Currently, we only take the first geometry and drop the rest.
This library is heavily inspired by python-geojson.
Usage
import esrijson
from shapely import geometry
# Create an esrijson feature
feat = esrijson.Feature(geometry=geometry.Point(1, 4), attributes={'name': 'dummy', 'val': 1}, wkid=2056)
# Dump to json
dumped = esrijson.dumps(feat)
# Load to Feature back again
loaded = esrijson.loads(dumped)
print(loaded)
print(type(loaded))
>>> {'geometry': {'y': 4.0, 'x': 1.0}, 'spatialReference': {u'wkid': 2056}},'attributes': {u'name': u'dummy', u'val': 1}}
>>> <class 'esrijson.feature.Feature'>
# You can also transform an esri json like object into a shapely object
geom = esrijson.to_shape({"paths": [[[0.0, 0.0], [1.0, 1.0]], [[-1.0, 0.0], [1.0, 0.0]]]})
print(getattr(geom, '__geo_interface__')
>>> {'type': 'MultiLineString', 'coordinates': (((0.0, 0.0), (1.0, 1.0)), ((-1.0, 0.0), (1.0, 0.0)))}
# And of your do the same operation back again
esri_geom = esrijson.from_shape(geom)
print(esri_geom)
>>> {'paths': (((0.0, 0.0), (1.0, 1.0)), ((-1.0, 0.0), (1.0, 0.0)))}
ESRI specs references
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
esrijson-0.4.4.tar.gz
(5.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file esrijson-0.4.4.tar.gz.
File metadata
- Download URL: esrijson-0.4.4.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.1.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
19b0443e8849184c7359dadfa8be8cb9d5b7d7ec6e6d73ec8ad4503acc2cb542
|
|
| MD5 |
e14f4e10ee8ee0d1be0200097631f24d
|
|
| BLAKE2b-256 |
1468eb660137deb8de6fe6dd85a673538992571368a7602fbeb0ecec52eb4391
|
File details
Details for the file esrijson-0.4.4-py3-none-any.whl.
File metadata
- Download URL: esrijson-0.4.4-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.1.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26ef946527f64b50d44386e843ad41b4cc3d5a5cff684a1cb91731a17295371b
|
|
| MD5 |
5a0fa2c8af2e4b6c7a7cf7c0507e8119
|
|
| BLAKE2b-256 |
8aa2b6a496c0a0556ef1ac520ab4ac58c3bd8db0aafefef9e66da0e36bf44f84
|