-
Notifications
You must be signed in to change notification settings - Fork 155
esriJSON feature arrays not captured by parse() in arcgis.js #104
Comments
@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 var FeatureCollection = {
type: "FeatureCollection",
features: []
}
for (var i = 0; i < arcgis.features.length; i++) {
var feature = Terraformer.ArcGIS.parse(arcgis.features[i]);
feature.id = i;
FeatureCollection.features.push(feature)
}; 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. |
Thanks for the clarification. |
@abenrob fleshed out the explanation a little hit "Comment" to soon. |
I believe you have a typo in your explanation. The following line: FeatureCollection.features.push(geojson) should probably read FeatureCollection.features.push(feature) right? |
@jeffreyhobson Thanks, corrected it. |
hello from 2018! in its also worth noting:
|
can you show me example, how to do it? in @esri/arcgis-to-geojson-utils we ultimately landed support for converting arrays of Esri JSON features into a GeoJSON FeatureCollection and auto-incrementing ids. |
@hoogw no need to respost the same question in three different places. i've answered you in Esri/arcgis-to-geojson-utils#30 (comment) |
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.
The text was updated successfully, but these errors were encountered: