Package Exports
- arcgis-x
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (arcgis-x) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
arcgis-x
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-xExample 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