Skip to content
This repository was archived by the owner on Mar 9, 2021. It is now read-only.

Commit c478370

Browse files
committed
allow converting and parsing null island
1 parent f83eb17 commit c478370

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

spec/arcgisSpec.js

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,23 @@ describe("ArcGIS Tools", function(){
3131
});
3232
});
3333

34+
it("should convert a GeoJSON Null Island to an ArcGIS Point", function() {
35+
var input = {
36+
"type": "Point",
37+
"coordinates": [0,0]
38+
};
39+
40+
var output = Terraformer.ArcGIS.convert(input);
41+
42+
expect(output).toEqual({
43+
"x":0,
44+
"y":0,
45+
"spatialReference":{
46+
"wkid":4326
47+
}
48+
});
49+
});
50+
3451
it("should convert a GeoJSON LineString to an ArcGIS Polyline", function() {
3552
var input = {
3653
"type": "LineString",
@@ -491,6 +508,21 @@ describe("ArcGIS Tools", function(){
491508
expect(output).toBeInstanceOfClass(Terraformer.Point);
492509
});
493510

511+
it("should parse an ArcGIS Null Island in a Terraformer GeoJSON Point", function() {
512+
var input = {
513+
"x": 0,
514+
"y": 0,
515+
"spatialReference": {
516+
"wkid": 4326
517+
}
518+
};
519+
520+
var output = Terraformer.ArcGIS.parse(input);
521+
522+
expect(output.coordinates).toEqual([0,0]);
523+
expect(output).toBeInstanceOfClass(Terraformer.Point);
524+
});
525+
494526
it("should parse an ArcGIS Polyline in a Terraformer GeoJSON LineString", function() {
495527
var input = {
496528
"paths": [
@@ -847,7 +879,6 @@ describe("ArcGIS Tools", function(){
847879

848880
expect(output.type).toEqual("LineString");
849881
expect(output.coordinates).toEqual([ [ -117.1816137447153, 34.057461545380946 ],[ -117.18159575425025, 34.06266078978142 ], [ -117.18154178285509, 34.06472969326257 ] ]);
850-
console.log(output);
851882
});
852883

853884
});

terraformer-arcgis-parser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@
228228
options = options || {};
229229
options.idAttribute = options.idAttribute || undefined;
230230

231-
if(arcgis.x && arcgis.y){
231+
if(typeof arcgis.x === 'number' && typeof arcgis.y === 'number'){
232232
geojson.type = "Point";
233233
geojson.coordinates = [arcgis.x, arcgis.y];
234234
}

0 commit comments

Comments
 (0)