terraformer-arcgis-parser nodejs模块错误示例代码?

我正在尝试使用nodejs模块: https : //github.com/Esri/terraformer-arcgis-parser

以下是我的代码直接从示例文档:

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] }); 

我得到一个:

 throw new Error("Unknown type: " + geojson.type); Error: Unknown type: undefined 

有什么问题? 这似乎不应该是一个问题…

arcgisparsing器期望x和y坐标是types“数字”,而不是你在你的例子中的string。

只要改变你的arcgis json x和y就可以了,像这样:

 var primitive = ArcGIS.parse({ x:-122.6764, y:45.5165, spatialReference: { wkid: 4326 } });