I am trying to use the nodejs module: https://github.com/Esri/terraformer-arcgis-parser
The following is my code directly from the sample documentation:
var ArcGIS = require('terraformer-arcgis-parser');
// parse ArcGIS JSON, convert it to a Terraformer.Primitive (GeoJSON)
var primitive = ArcGIS.parse({
x:"-122.6764",
y:"45.5165",
spatialReference: {
wkid: 4326
}
});
// take a Terraformer.Primitive or GeoJSON and convert it back to ArcGIS JSON
var point = ArcGIS.convert({
"type": "Point",
"coordinates": [45.5165, -122.6764]
});
I am getting a:
throw new Error("Unknown type: " + geojson.type);
Error: Unknown type: undefined
What is the issue? It seems like this should not even be a problem...
The arcgis parser expects the x and y coordinates to be of type "number", not string as you have it in your example.
Just change your arcgis json x and y to floats, like this:
var primitive = ArcGIS.parse({
x:-122.6764,
y:45.5165,
spatialReference: {
wkid: 4326
}
});