Skip to main content

A Python library for converting ArcGIS JSON to GeoJSON

Project description

Run tests codecov PyPI Version License Python Compatibility Code style: black

arcgis2geojson.py

A Python library for converting ArcGIS JSON to GeoJSON: A partial port of ESRI's arcgis-to-geojson-utils.

Installation

pip install arcgis2geojson

Usage

As a Library

Convert an ArcGIS JSON string to a GeoJSON string

>>> 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'>

Convert a python dict to a python dict

>>> 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'>

On the Console

# 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

Versioning

arcgis2geojson follows semantic versioning. For this project, the "API" also includes:

  • CLI flags and options
  • CLI exit codes

From version 3 onwards, arcgis2geojson will drop compatibility with unsupported python versions without incrementing the major version. This is in line with common practice in the python community.

Licensing

arcgis2geojson is a derivative work of ESRI's arcgis-to-geojson-utils. Original code is Copyright 2015 by Esri and was licensed under the Apache License, Version 2.0.

arcgis2geojson is made available under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

arcgis2geojson-3.1.1.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

arcgis2geojson-3.1.1-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file arcgis2geojson-3.1.1.tar.gz.

File metadata

  • Download URL: arcgis2geojson-3.1.1.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for arcgis2geojson-3.1.1.tar.gz
Algorithm Hash digest
SHA256 cab61e119a59bbee0df091531e6a242ca0835c348ab68e2f4671b39464c3bb4d
MD5 c2dd6f9af7f38d9a548f0b143058b10d
BLAKE2b-256 78048f50099f2a1af522119bc0b552719904a2cee5a2abb70a9c0eec72071a5a

See more details on using hashes here.

Provenance

The following attestation bundles were made for arcgis2geojson-3.1.1.tar.gz:

Publisher: publish.yml on chris48s/arcgis2geojson

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file arcgis2geojson-3.1.1-py3-none-any.whl.

File metadata

  • Download URL: arcgis2geojson-3.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for arcgis2geojson-3.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5c52b2ea460072d6961e0c37cc0407d3ae9f7c65bca6cae92435378edfa324b1
MD5 872c1c793021c9f16b156858aa1e1f40
BLAKE2b-256 d50216cbc3a6ada4937f64336b4b0e68e32be8817ccefc91ed13c3e4575ef552

See more details on using hashes here.

Provenance

The following attestation bundles were made for arcgis2geojson-3.1.1-py3-none-any.whl:

Publisher: publish.yml on chris48s/arcgis2geojson

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page