Socket
Socket
Sign inDemoInstall

@tommy2gis/arcgis-x

Package Overview
Dependencies
99
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @tommy2gis/arcgis-x

Convert ArcGIS REST Service Data to GeoJSON or CSV-KML.


Version published
Maintainers
1
Created

Readme

Source

arcgis-x

CircleCI NPM PR's Welcome License: MIT

Node.js library for converting ArcGIS REST Service data to GeoJSON or CSV-KML (Google Earth, Google Fusion Tables)

Installation

NPM:

$ npm install --save arcgis-x

Example Usage

Import
import arcgisX from "arcgis-x";
let sample = {
  spatialReference: {
    wkid: 4326
  },
  features: [
    {
      attributes: {
        borough: "Brooklyn"
      },
      geometry: {
        rings: [
          [
            [-73.9760507905698, 40.6312841471042],
            [-73.9770549623761, 40.6215407613162],
            [-73.9751732026353, 40.6147324241179],
            [-74.0055663474715, 40.6330914171937],
            [-73.985096633962, 40.6425812992004],
            [-73.9760507905698, 40.6312841471042]
          ]
        ]
      }
    }
  ]
};
toGeoJson()
let geojson = arcgisX.toGeoJson(sample);

//  {
//    type: 'FeatureCollection',
//    features: [
//      { type: 'Feature', geometry: [Polygon], properties: [Object] }
//    ]
//  }
toKml()
let kml = arcgisX.toKml(
  sample,
  {
    stroke: "#666666",
    "stroke-width": 2,
    fill: "#ff0000",
    "fill-opacity": 0.5
  },
  { simplestyle: true }
);

//  <?xml version="1.0" encoding="UTF-8"?>
//  <kml xmlns="http://www.opengis.net/kml/2.2">
//    <Document>
//      <Style id="s666666sw2fff0000fo05">
//        <LineStyle>
//          <color>ff666666</color>
//          <width>2</width>
//        </LineStyle>
//        <PolyStyle>
//          <color>7f0000ff</color>
//        </PolyStyle>
//      </Style>
//      <Placemark>
//        <ExtendedData>
//          <Data name="borough">
//            <value>Brooklyn</value>
//          </Data>
//          <Data name="stroke">
//            <value>#666666</value>
//          </Data>
//          <Data name="stroke-width">
//            <value>2</value>
//          </Data>
//          <Data name="fill">
//            <value>#ff0000</value>
//          </Data>
//          <Data name="fill-opacity">
//            <value>0.5</value>
//          </Data>
//        </ExtendedData>
//        <Polygon>
//          <outerBoundaryIs>
//            <LinearRing>
//              <coordinates>-73.9760507906,40.6312841471 -73.985096634,40.6425812992 -74.0055663475,40.633091417//2 -73.9751732026,40.6147324241 -73.9770549624,40.6215407613 -73.9760507906,40.6312841471</coordinates>
//            </LinearRing>
//          </outerBoundaryIs>
//        </Polygon>
//        <styleUrl>#s666666sw2fff0000fo05</styleUrl>
//      </Placemark>
//    </Document>
//  </kml>
toCsvKml()
let csvKml = arcgisX.toCsvKml(sample);

//  "borough"|"geometry"
//  "Brooklyn"|"<Polygon><outerBoundaryIs><LinearRing><coordinates>-73.9760507906,40.6312841471 -73.985096634,40.6425812992 -74.0055663475,40.6330914172 -73.9751732026,40.6147324241 -73.9770549624,40.6215407613 -73.9760507906,40.6312841471</coordinates></LinearRing></outerBoundaryIs></Polygon>"

Roadmap (Tentative)

  • Directly upload CSV-KML output to Google Fusion Table.
  • Read input from files. Write output to files.

License

MIT

Keywords

FAQs

Last updated on 10 Aug 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc