一个将ArcGIS JSON转换为GeoJSON的Python库
项目描述
arcgis2geojson.py
A Python library for converting ArcGIS JSON to GeoJSON: A partial port of ESRI's arcgis-to-geojson-utils.
安装
pip install arcgis2geojson
使用
作为库
将ArcGIS JSON字符串转换为GeoJSON字符串
>>> from arcgis2geojson import arcgis2geojson
>>> input = """{
... "attributes": {"OBJECTID": 123},
... "geometry": { "rings": [ [ [41.8359375, 71.015625],
... [56.953125, 33.75],
... [21.796875, 36.5625],
... [41.8359375, 71.015625]]],
... "spatialReference": {"wkid": 4326}}}"""
>>> output = arcgis2geojson(input)
>>> output
'{"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[41.8359375, 71.015625], [21.796875, 36.5625], [56.953125, 33.75], [41.8359375, 71.015625]]]}, "properties": {"OBJECTID": 123}, "id": 123}'
>>> type(output)
<class 'str'>
将python字典转换为python字典
>>> from arcgis2geojson import arcgis2geojson
>>> input = {
... 'attributes': {'OBJECTID': 123},
... 'geometry': { 'rings': [ [ [41.8359375, 71.015625],
... [56.953125, 33.75],
... [21.796875, 36.5625],
... [41.8359375, 71.015625]]],
... 'spatialReference': {'wkid': 4326}}}
>>> output = arcgis2geojson(input)
>>> output
{'type': 'Feature', 'geometry': {'type': 'Polygon', 'coordinates': [[[41.8359375, 71.015625], [21.796875, 36.5625], [56.953125, 33.75], [41.8359375, 71.015625]]]}, 'properties': {'OBJECTID': 123}, 'id': 123}
>>> type(output)
<class 'dict'>
在控制台
# convert ArcGIS json file to GeoJOSN file
$ arcgis2geojson arcgis.json > geo.json
# fetch ArcGIS json from the web and convert to GeoJSON
$ curl "https://myserver.com/arcgis.json" | arcgis2geojson
许可
arcgis2geojson是ESRI的arcgis-to-geojson-utils的衍生作品。原始代码由Esri于2015年版权所有,并许可在Apache许可证2.0版本下。
arcgis2geojson在MIT许可证下提供。
项目详情
关闭
arcgis2geojson-3.0.3.tar.gz的散列值
算法 | 散列摘要 | |
---|---|---|
SHA256 | 72350c0652134393130e47e2d5a6d83d695fa7fe79b6bd763725afb146c5c889 |
|
MD5 | 0172b818bd66cc60f1dfa68c56f98c87 |
|
BLAKE2b-256 | 7ebc9245b2d6f09ab091450f847fc9994c78964f73109760e0dade25b31a5957 |
关闭
arcgis2geojson-3.0.3-py3-none-any.whl的散列值
算法 | 散列摘要 | |
---|---|---|
SHA256 | 8392988c7fd3460812490126e139a45f72e56574dc3e3fbcee259cfb084306b1 |
|
MD5 | 1fafe6c7f40b3c238f671c55a3164adc |
|
BLAKE2b-256 | 0309f6a251945261e7dceaccb08cacdcbff3618526e8dd03a3607d04f0941bbc |