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-x
Example Usage
Import
;
let sample = spatialReference: wkid: 4326 features: attributes: borough: "Brooklyn" geometry: rings: -739760507905698 406312841471042 -739770549623761 406215407613162 -739751732026353 406147324241179 -740055663474715 406330914171937 -73985096633962 406425812992004 -739760507905698 406312841471042 ;
toGeoJson()
let geojson = arcgisX; // {// type: 'FeatureCollection',// features: [// { type: 'Feature', geometry: [Polygon], properties: [Object] }// ]// }
toKml()
let kml = arcgisX; // <?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; // "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