AnsweredAssumed Answered

JSON  Shapefile

Question asked by alex.gole_ELDORADOCOUNTY on Nov 7, 2017

Hi all,


I am trying to write JSON to a shapefile from my JS app.  I am using two third party libs here.

1. Terraformer to parse JSON to GeoJSON

2. GitHub - mapbox/shp-write: create and write to shapefiles in pure javascript 




 <script src="" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
    <!-- Latest compiled and minified JavaScript -->
    <script src="" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
            var dojoConfig = {
              parseOnLoad: true,
              packages: [{
                "name": "shpwrite",
                "location": location.pathname.replace(/\/[^/]+$/, "") + '/js'
    <script src=""></script>
    <script src=""></script>
    <script src="js/shpwrite.js"></script>
    <script src=""></script>
      var map;
      var AOI;
      var gp;
      var DrawToolbar;

      var options = {
        folder: 'myshapes',
        types: {
            point: 'mypoints',
            polygon: 'mypolygons',
            line: 'mylines'

DrawToolbar.on("draw-end", function(e) {
            var symbol = new SimpleFillSymbol(
              new SimpleLineSymbol("dash", new Color([255,0,0]), 2),
              new Color([255,255,0,0.25])
            var graphic = new Graphic(e.geometry, symbol);
            var json = graphic.toJson();
            // parse an ArcGIS Geometry to GeoJSON
            var Areas = Terraformer.ArcGIS.parse(json);
            type: 'FeatureCollection',
            features: Areas
            }, options);

I get this error: 


Any idea?