Select to view content in your preferred language

geometryEngine.geodesicArea bug?

1717
5
Jump to solution
11-07-2018 05:55 PM
LefterisKoumis
Frequent Contributor

I have this simple code that it displays a graphic. So, geometry is ok. When I attempt to calculate the area of the graphic (line 5)  I get this error. Why? Thanks.

var newbuffer = geometryEngine.difference(buffer,polygongeom);
newbuffer.setSpatialReference(new SpatialReference({ wkid: 102110}));
var buffergraphic = new esri.Graphic(newbuffer, bufferSym);

var thebufferarea= geometryEngine.geodesicArea(geometryEngine.simplify(buffergraphic.geometry), 'acres');
console.log(thebufferarea)
bufferGraphicsLayer.add(buffergraphic);‍‍‍‍‍‍‍‍‍‍‍
------------
this.map.addLayer(bufferGraphicsLayer)‍‍‍‍‍‍‍‍‍

the root of the error is at line 559, which is line 5 above.

1 Solution

Accepted Solutions
DanPatterson_Retired
MVP Emeritus

Not implemented isn't a bug, it means it has limitations for its use.  It either isn't implemented for graphics or it doesn't like your coordinate system.

For example, the WGS 1984 Web Mercator (Auxiliary Sphere) projection was originally assigned WKID 102100, but was later changed to 3857.

But if is that picky about the renaming, no clue.  The python variant of this is similar 

This method only works with WGS-84 (wkid: 4326) and Web Mercator (wkid: 3857) spatial references.

esri/geometry/geometryEngine | API Reference | ArcGIS API for JavaScript 3.26 

View solution in original post

5 Replies
DanPatterson_Retired
MVP Emeritus

Not implemented isn't a bug, it means it has limitations for its use.  It either isn't implemented for graphics or it doesn't like your coordinate system.

For example, the WGS 1984 Web Mercator (Auxiliary Sphere) projection was originally assigned WKID 102100, but was later changed to 3857.

But if is that picky about the renaming, no clue.  The python variant of this is similar 

This method only works with WGS-84 (wkid: 4326) and Web Mercator (wkid: 3857) spatial references.

esri/geometry/geometryEngine | API Reference | ArcGIS API for JavaScript 3.26 

LefterisKoumis
Frequent Contributor

Thank you! that was it. 

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Lefteris,

  1.   Have you console logged the newbuffer to be sure it is not null?
  2. What is the spatialReference before you set it to 102100?
  3. Did you try setting to 3857 instead of 102100 (this should not make a difference though)?
  4. Have you logged what the result of geometryEngine.simplify(newbuffer)?
LefterisKoumis
Frequent Contributor

Thank you. Changing the Wkid to 3857 made it work!

arahman_mdmajid
Frequent Contributor

Thank you for saving the day. Projecting to 3857 worked

Abdur Rahman
GIS Developer
0 Kudos