Select to view content in your preferred language

Trouble with normalUtils/normalizeCentralMeridian()

462
0
04-11-2018 12:34 PM
MansiShah
New Contributor III

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:

    1. Array(5)
      1. 0:(2) [-231.97361670477855, 37.030176591569784]
      2. 1:(2) [-231.55174142868816, 37.030176591569784]
      3. 2:(2) [-231.55174142868816, 36.907130250716335]
      4. 3:(2) [-231.97361670477855, 36.907130250716335]
      5. 4:(2) [-231.97361670477855, 37.030176591569784]
      6. length:5
      7. __proto__:Array(0)
    2. cache:(...)
    3. center:(...)
    4. extent:(...)
    5. hasM:(...)
    6. hasZ:(...)
    7. height:(...)
    8. length:1
    9. mmax:(...)
    10. mmin:(...)
    11. spatialReference:Object
      1. isGeographic:true
      2. isWGS84:true
      3. isWebMercator:false
      4. isWrappable:true
      5. latestVcsWkid:undefined
      6. latestWkid:null
      7. vcsWkid:undefined
      8. wkid:4326
      9. 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!

Tags (1)
0 Kudos
0 Replies