Giter Club home page Giter Club logo

arcgis-to-geojson-utils's Introduction

Important

arcgis-to-geojson-utils is no longer maintained. It is recommended to migrate to https://github.com/terraformer-js/terraformer/blob/master/packages/arcgis/README.md.

arcgis-to-geojson-utils

npm travis standard

Tools to convert ArcGIS JSON geometries to GeoJSON geometries and vice versa.

Install

npm install @esri/arcgis-to-geojson-utils

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 ArcgisToGeojsonUtils namespace.

<script src="https://unpkg.com/@esri/arcgis-to-geojson-utils"></script>
ArcgisToGeojsonUtils.arcgisToGeoJSON({
    "x":-122.6764,
    "y":45.5165,
    "spatialReference": {
      "wkid": 4326
    }
});

ES6

import { arcgisToGeoJSON } from '@esri/arcgis-to-geojson-utils';
import { geojsonToArcGIS } from '@esri/arcgis-to-geojson-utils';

// parse ArcGIS JSON, convert it to GeoJSON
const geojson = arcgisToGeoJSON({
    "x":-122.6764,
    "y":45.5165,
    "spatialReference": {
      "wkid": 4326
    }
  });

// take GeoJSON and convert it to ArcGIS JSON
const arcgis = geojsonToArcGIS({
  "type": "Point",
  "coordinates": [45.5165, -122.6764]
});

Node.js

const esriUtils = require('@esri/arcgis-to-geojson-utils');

esriUtils.geojsonToArcGIS(/* ... */);
esriUtils.arcgisToGeoJSON(/* ... */);

Thanks to @JeffJacobson, TypeScript typings and tests can be found on npm.

We recommend using --moduleResolution Node to ensure the compiler recognizes the types.

Issues

Find a bug or want to request a new feature? Please let us know by submitting an issue.

Contributing

Esri welcomes contributions from anyone and everyone. Please see our guidelines for contributing.

Ports

Project Language Status Maintainer
arcgis2geojson Python Incomplete @chris48s

Licensing

Copyright © 2015-2018 Esri

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

A copy of the license is available in the repository's LICENSE file.

arcgis-to-geojson-utils's People

Contributors

chidg avatar chris48s avatar corinchappy avatar jgravois avatar patrickarlt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arcgis-to-geojson-utils's Issues

How to convert arcgis featureSet to geojson?

How to convert arcgis featureSet to geojson?

I understand this module only convert a single arcgis geometry to geojson,

However, the response from arcgis rest api, are NOT geometry,

instead, they are FeatureSet.

Can you add the function to convert arcgis FeatureSet to geojson?

Need help with 2.2 version Typings

Hi,

There are 2 dependencies for @types/arcgis-to-geojson-utils:
@types/arcgis-rest-api
https://www.npmjs.com/package/%40types%2Farcgis-rest-api
@types/geojson
https://www.npmjs.com/package/%40types%2Fgeojson

I am working with project which is having Typescript version 2.2. and this version is kind of frozen for the project :(
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/geojson/index.d.ts
This file is giving error as it is using Typescript version 2.3

Can I get typings for 2.2 version anywhere? :(
As even '@types/arcgis-rest-api' is working fine on Ts version 2.2

Can anybody help? Where I can get 2.2 Typings?

Thanks and Regards,
Amruta

rename repository to arcgis-to-geojson-utils?

it took me a bit to figure out that the npm package is actually arcgis-to-geojson-utils

at a bare minimum the readme title, npm install instructions, badge, code snippets, etc. need to be updated...

ArcGIS JSON structure is not getting formed

When I am generating ArcGIS JSON from any toolbox it will always have "features" and under that it will have "geometry" and attributes inside of it but this code is not doing that.
Also, "geometryType": "esriGeometryPolygon" these are the geometry tyoe which are also not coming as a part of json.
Sample ESRI JSON format(generated from features to json toolbox in ArcMap) is as below:

{
    "displayFieldName": "",
    "features": [
        {
            "attributes": {
                "OBJECTID": 1,
                "OutlineComment": "testoutline",
                "ResourceID": "201",
                "SHAPE_Area": 0.006233100233813974,
                "SHAPE_Length": 0.4874967906258057
            },
            "geometry": {
                "rings": [
                    [
                        [
                            -73.58145436999996,
                            -36.33218832299997
                        ],
                        [
                            -73.52149838699995,
                            -36.295079320999946
                        ],
                        [
                            -73.55052137699994,
                            -36.353603471999975
                        ],
                        [
                            -73.52482963299997,
                            -36.43832287399994
                        ],
                        [
                            -73.58145436999996,
                            -36.394054308999955
                        ],
                        [
                            -73.59573113599998,
                            -36.37501862099998
                        ],
                        [
                            -73.65474820399999,
                            -36.398347928999954
                        ],
                        [
                            -73.60762844099997,
                            -36.336947244999976
                        ],
                        [
                            -73.58145436999996,
                            -36.33218832299997
                        ]
                    ]
                ]
            }
        }
    ],
    "fieldAliases": {
        "OBJECTID": "OBJECTID",
        "OutlineComment": "OutlineComment",
        "ResourceID": "ResourceID",
        "SHAPE_Area": "SHAPE_Area",
        "SHAPE_Length": "SHAPE_Length"
    },
    "fields": [
        {
            "alias": "OBJECTID",
            "name": "OBJECTID",
            "type": "esriFieldTypeOID"
        },
        {
            "alias": "ResourceID",
            "length": 50,
            "name": "ResourceID",
            "type": "esriFieldTypeString"
        },
        {
            "alias": "OutlineComment",
            "length": 50,
            "name": "OutlineComment",
            "type": "esriFieldTypeString"
        },
        {
            "alias": "SHAPE_Length",
            "name": "SHAPE_Length",
            "type": "esriFieldTypeDouble"
        },
        {
            "alias": "SHAPE_Area",
            "name": "SHAPE_Area",
            "type": "esriFieldTypeDouble"
        }
    ],
    "geometryType": "esriGeometryPolygon",
    "spatialReference": {
        "latestWkid": 4326,
        "wkid": 4326
    }
}

Also following is the JSON which arcgis - to - geojson-utils is generating:

image

Not able to use arcgis-to-geojson-utils Typings successfully

Hi ,
I am setting up a typescript application and it's structure looks like this:
image

Typings file looks like this:
image

Package.json looks like this:
image

When I am running the application, I am getting this error:
image

I am not sure, how the code is trying to access the arcgis-to-geojson utils from ArcGIS JS API even when declaration files are mentioned in typings.d.ts

I am new to typescript and not sure if I am doing something wrong here.

Thanks and Regards,
Amruta

Unexpected difference from Terraformer Parser

I am not sure what you want to do with this information, but in switching from Terraformer Parser I ran into the following unexpected change:

For this feature:

{
  "attributes": {
    "PROJ_DESC": "REMODEL FOR DRINK STATION ON FLOOR 3. C/C                         "
  },
  "geometry": {
    "x": "NaN",
    "y": "NaN"
  }
}

Found in the wild

Terraformer parser returns [Error: Unknown type: undefined]
Whereas this module returns {}

I know these are separate projects, but I thought you might want to be aware of this difference.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.