Hello,
I am trying to use the normalizeCentralMeridian method to normalize the coordinates over dateline. I have the following code:
var rings = JSON.stringify(evt.geometry.rings);
var genoms = new Extent(evt.geometry.rings); //I have also tested making genoms of type new Geometry with the same //outcome
console.log("genoms: ", genoms);
console.log("before normalizeUtils.normalizeCentralMeridian()");
console.log(normalizeUtils.normalizeCentralMeridian(geoms);
evt.geometry.rings is an array object. Printing it out gives me the following:
[[[-232.56299422870526,37.89843860927253],[-232.35205659066006,37.89843860927253],[-232.35205659066006,37.766602669313315],[-232.56299422870526,37.766602669313315],[-232.56299422870526,37.89843860927253]]]
Printing out genoms gives me the following:
- Array(5)
- 0:(2) [-231.97361670477855, 37.030176591569784]
- 1:(2) [-231.55174142868816, 37.030176591569784]
- 2:(2) [-231.55174142868816, 36.907130250716335]
- 3:(2) [-231.97361670477855, 36.907130250716335]
- 4:(2) [-231.97361670477855, 37.030176591569784]
- length:5
- __proto__:Array(0)
- cache:(...)
- center:(...)
- extent:(...)
- hasM:(...)
- hasZ:(...)
- height:(...)
- length:1
- mmax:(...)
- mmin:(...)
- spatialReference:Object
- isGeographic:true
- isWGS84:true
- isWebMercator:false
- isWrappable:true
- latestVcsWkid:undefined
- latestWkid:null
- vcsWkid:undefined
- wkid:4326
- wkt:(...)
**ignore the changes in the x, and y coordinates, I had to draw the area of interest on the map again after refreshing the application**
I want to be able to normalize the coordinates so I wanted to use the normalizeCentralMeridian() method (normalizeUtils | API Reference | ArcGIS API for JavaScript 4.6) but I get an error on the 3rd line of the code above with the message:
before normalizeUtils.normalizeCentralMeridian()
Uncaught TypeError: Cannot read property 'wkid' of undefined
at Object.f.getInfo (dojo.js:476)
at dojo.js:1291
at Object.forEach (dojo.js:126)
at Object.normalizeCentralMeridian (dojo.js:1291)
at Object.<anonymous> (TfdmMapCtrl.js:732)
at Object.e [as ondraw-end] (dojo.js:64)
at Function.d.emit (dojo.js:51)
at Function.d.emit (dojo.js:53)
at Object.emit (dojo.js:62)
at Object._end (DrawExtent.js:175)
When you look at the reference page for normalizeUtils, it can take an argument of type Extent because it is a subclass of type Geometry. the wkid property is part of the SpatialReference object but even if I add a wkid property (by doing genoms.wkid = 4326) I get the same error as above.
Has anyone else encountered this issue and can help. Thank you so much!