Skip to content

esriJSON feature arrays not captured by parse() in arcgis.js #104

abenrob opened this Issue Jun 22, 2013 · 5 comments

3 participants

abenrob commented Jun 22, 2013

Is this intentional?
When I point to an AGS JSON rest endpoint and try to parse to geoJSON, the object matches no cases and the geoJSON object remains empty.
If I limit to one feature (e.g. arcgis.features[0]) the conversion succeeds.

Esri member

@abenrob There is an explict reason we don't support this but do support converting single features. When you parse a feature into GeoJSON like

var geojson = Terraformer.ArcGIS.parse(arcgis.features[0]);

Does not produce valid GeoJSON because is undefined. Valid GeoJSON Features must have a id property. Since converting an array of ArcGIS features to an array of GeoJSON Features would result in alot of invalud GeoJSON you should do this in a loop like this...

var FeatureCollection = {
  type: "FeatureCollection",
  features: []

for (var i = 0; i < arcgis.features.length; i++) {
  var feature = Terraformer.ArcGIS.parse(arcgis.features[i]); = i;

If we allow passing an array we also open our selves up to bugs where mixed arrays of geometries and features are passed (which cant exist in GeoJSON) and would require us to sort them out into FeatureCollections or GeometryCollections.

abenrob commented Jun 24, 2013

Thanks for the clarification.

Esri member

@abenrob fleshed out the explanation a little hit "Comment" to soon.

jhobz commented Jul 11, 2013

I believe you have a typo in your explanation. The following line:


should probably read



Esri member

@jeffreyhobson Thanks, corrected it.

@jgravois jgravois referenced this issue in Esri/terraformer-arcgis-parser Mar 16, 2016

add FeatureSet to FeatureCollection #31

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.