Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@terraformer/arcgis

terraformer-js201.1kMIT2.1.2TypeScript support: definitely-typed

Convert ArcGIS JSON geometries to GeoJSON geometries and vica-versa.

arcgis, convert, geo, geojson, geometry

readme

@terraformer/arcgis

npm travis standard

Convert ArcGIS JSON geometries to GeoJSON geometries and vice versa.

Install

npm install @terraformer/arcgis

API Reference

Terraformer

Terraformer.arcgisToGeoJSON(JSON, [idAttribute]) ⇒ object

Converts ArcGIS JSON into GeoJSON.

Kind: static method of Terraformer
Returns: object - GeoJSON.

import { arcgisToGeoJSON } from "@terraformer/arcgis"

arcgisToGeoJSON({
  "x":-122.6764,
  "y":45.5165,
  "spatialReference": {
    "wkid": 4326
  }
});

>> { "type": "Point", "coordinates": [ -122.6764, 45.5165 ] }
Param Type Description
JSON object The input ArcGIS geometry, feature or feature collection.
[idAttribute] string When converting an ArcGIS Feature its attributes will contain the ID of the feature. If something other than OBJECTID or FID stores the ID, you should pass through the fieldname explicitly.

Terraformer.geojsonToArcGIS(GeoJSON, [idAttribute]) ⇒ object

Converts GeoJSON into ArcGIS JSON.

Kind: static method of Terraformer
Returns: object - ArcGIS JSON.

import { geojsonToArcGIS } from "@terraformer/arcgis"

geojsonToArcGIS({
  "type": "Point",
  "coordinates": [45.5165, -122.6764]
})

>> { "x":-122.6764, "y":45.5165, "spatialReference": { "wkid": 4326 } }
Param Type Description
GeoJSON object The input GeoJSON Geometry, Feature, GeometryCollection or FeatureCollection.
[idAttribute] string When converting GeoJSON features, the id will be set as the OBJECTID unless another fieldname is supplied.

Usage

Browser (from CDN)

This package is distributed as a UMD module and can also be used in AMD based systems or as a global under the Terraformer namespace.

<script src="https://unpkg.com/@terraformer/arcgis"></script>
Terraformer.arcgisToGeoJSON(/* ... */);

Node.js

const Terraformer = require('@terraformer/arcgis');

Terraformer.geojsonToArcGIS(/* ... */);

ES module in the browser

<script type='module'>
  import { arcgisToGeoJSON } from 'https://unpkg.com/@terraformer/arcgis?module';

  // look ma, no build step!
  arcgisToGeoJSON(/* ... */);
</script>

Contributing

TypeScript

Type definitions for @terraformer/arcgis can be found at @types/terraformer__arcgis. To install into your own project:

npm install @types/terraformer__arcgis

Ports

Project Language Status Maintainer
arcgis2geojson Python Incomplete @chris48s

LICENSE

changelog

Change log

All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning.

Unreleased

Fixed

  • intersects for multipolygons

[2.1.1] - 2022-05-31

Fixed

  • ensure Z values of 0 are carried through when converting GeoJSON to ArcGIS Geometries.

2.1.0 - 2021-07-22

Added

  • added support for Z values when converting GeoJSON to ArcGIS Geometries.

2.0.7 - 2020-05-18

Fixed

  • all UMD and ESM files are now transpiled to make them safe to use in older browsers.

2.0.5 - 2020-05-17

Fixed

  • @terraformer/spatial
    • toCircle() now returns polygons of equal area, regardless of their latitude

2.0.0 - 2020-04-15

Changed

  • New Package names:

    • terraformer > @terraformer/spatial.
    • terraformer-arcgis-parser > @terraformer/arcgis.
    • terraformer-wkt-parser > @terraformer/wkt.
  • All packages are now standalone.