<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Area calculation in planar with WebMercator polygon in Web AppBuilder Custom Widgets Questions</title>
    <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/area-calculation-in-planar-with-webmercator/m-p/1119556#M14651</link>
    <description>&lt;P&gt;Init attempt shows odd results.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;WKID:&amp;nbsp;102658&lt;/P&gt;&lt;P&gt;When feature class is imported into an FGDB and projection of wkid referenced above is applied, the area is quite different from when I implement:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var sr = new SpatialReference({ wkid: 102658 }); //102100 102658  102258 3857 2881 https://spatialreference.org/ref/esri/102258/				  
				  geom.setSpatialReference(sr);
				  sqFt = geometryEngine.planarArea(geom, "square-feet").toPrecision(7);
				  console.log('sqFt: ' + sqFt)&lt;/LI-CODE&gt;&lt;P&gt;Areas calculated:&lt;/P&gt;&lt;P&gt;1. ArcGIS Desktop 10.8.1:&amp;nbsp; 61133457.122888&lt;/P&gt;&lt;P&gt;2. planarArea() Javascript&amp;amp;colon;&amp;nbsp; 7273987.555021531&lt;/P&gt;</description>
    <pubDate>Tue, 23 Nov 2021 15:52:13 GMT</pubDate>
    <dc:creator>JamesCrandall</dc:creator>
    <dc:date>2021-11-23T15:52:13Z</dc:date>
    <item>
      <title>Area calculation in planar with WebMercator polygon</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/area-calculation-in-planar-with-webmercator/m-p/1119523#M14650</link>
      <description>&lt;P&gt;JS 3.x&lt;/P&gt;&lt;P&gt;Before I got too far into this, wondering if anyone can point example of calculating more accurate acreage of input geometry of a web mercator aux sphere defined feature service?&amp;nbsp; I am currently determining acreage value calculations with&amp;nbsp; this function that implements&amp;nbsp;esri.geometry.geodesicAreas but we see a discrepancy in values when we use ArcGIS Desktop and apply a planar projection to the same boundary.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;getAcreageValueFromPolygon: function (geom) {
			  
			  var geometryService = new GeometryService("https://utility.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer");
			  var geographicGeometries = [];
			  //if self intersecting, simplify using geometry service
			  if (esri.geometry.polygonSelfIntersecting(geom)) {
				  //if self intersecting, simplify using geometry service
				  geometryService.simplify([geom], function (simplifiedGeometries) {
					  dojo.forEach(simplifiedGeometries, function (simplifiedGeometry, idx) {
						  geographicGeometries.push(esri.geometry.webMercatorToGeographic(simplifiedGeometry));
					  });
					  var areas = esri.geometry.geodesicAreas(geographicGeometries, esri.Units.ACRES);
					  acrevalue = new Number(areas[0]);
					  acrevalue = parseFloat(acrevalue.toPrecision(3));
				  });
			  }
			  else {
				  geographicGeometries.push(esri.geometry.webMercatorToGeographic(geom));
				  var areas = esri.geometry.geodesicAreas(geographicGeometries, esri.Units.ACRES);

				  acrevalue = new Number(areas[0]);
				  acrevalue = acrevalue.toPrecision(3);
			  }			  
			  return acrevalue
		  },&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think I'm simply looking for examples of applying a State Plane projection to the input geometry and calling planarAreas() instead.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Nov 2021 14:02:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/area-calculation-in-planar-with-webmercator/m-p/1119523#M14650</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2021-11-23T14:02:14Z</dc:date>
    </item>
    <item>
      <title>Re: Area calculation in planar with WebMercator polygon</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/area-calculation-in-planar-with-webmercator/m-p/1119556#M14651</link>
      <description>&lt;P&gt;Init attempt shows odd results.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;WKID:&amp;nbsp;102658&lt;/P&gt;&lt;P&gt;When feature class is imported into an FGDB and projection of wkid referenced above is applied, the area is quite different from when I implement:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var sr = new SpatialReference({ wkid: 102658 }); //102100 102658  102258 3857 2881 https://spatialreference.org/ref/esri/102258/				  
				  geom.setSpatialReference(sr);
				  sqFt = geometryEngine.planarArea(geom, "square-feet").toPrecision(7);
				  console.log('sqFt: ' + sqFt)&lt;/LI-CODE&gt;&lt;P&gt;Areas calculated:&lt;/P&gt;&lt;P&gt;1. ArcGIS Desktop 10.8.1:&amp;nbsp; 61133457.122888&lt;/P&gt;&lt;P&gt;2. planarArea() Javascript&amp;amp;colon;&amp;nbsp; 7273987.555021531&lt;/P&gt;</description>
      <pubDate>Tue, 23 Nov 2021 15:52:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/area-calculation-in-planar-with-webmercator/m-p/1119556#M14651</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2021-11-23T15:52:13Z</dc:date>
    </item>
    <item>
      <title>Re: Area calculation in planar with WebMercator polygon</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/area-calculation-in-planar-with-webmercator/m-p/1119653#M14652</link>
      <description>&lt;P&gt;Last attempt with cleaned up compare checker.&amp;nbsp; Results in console:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sqFtGeodesic: 61138987.116298884&lt;/P&gt;&lt;P&gt;sqFtPlanar: 7273987.501667344&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;				  geographicGeometries.push(esri.geometry.webMercatorToGeographic(geom));				  
				  sqFtGeodesic = esri.geometry.geodesicAreas(geographicGeometries, esri.Units.SQUARE_FEET);
				  console.log('sqFtGeodesic: ' + sqFtGeodesic)

				  var sr = new SpatialReference({ wkid: 102658 }); //102100 102658  102258 3857 2881 https://spatialreference.org/ref/esri/102258/
				  geom.setSpatialReference(sr);
				  sqFtPlanar = geometryEngine.planarArea(geom, "square-feet");
				  console.log('sqFtPlanar: ' + sqFtPlanar)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Nov 2021 19:39:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/area-calculation-in-planar-with-webmercator/m-p/1119653#M14652</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2021-11-23T19:39:13Z</dc:date>
    </item>
    <item>
      <title>Re: Area calculation in planar with WebMercator polygon</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/area-calculation-in-planar-with-webmercator/m-p/1119705#M14653</link>
      <description>&lt;P&gt;Just want to be clear.&amp;nbsp;&lt;/P&gt;&lt;P&gt;None of the examples above are for Web-mercator geometry right? they are for the Florida state plane? (projected).&amp;nbsp; I just see a lot of queries about area and length calculations being "off" when using web mercator sourced data&lt;/P&gt;</description>
      <pubDate>Tue, 23 Nov 2021 22:01:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/area-calculation-in-planar-with-webmercator/m-p/1119705#M14653</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-11-23T22:01:41Z</dc:date>
    </item>
    <item>
      <title>Re: Area calculation in planar with WebMercator polygon</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/area-calculation-in-planar-with-webmercator/m-p/1120455#M14654</link>
      <description>&lt;P&gt;All of our map services are sourced as Web Mercator Aux Sphere projection.&amp;nbsp; We're comparing against the same polygon that was projected to StatePlane in Pro and I wanted to get rid of the discrepancy that geodesicArea() produced.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The thing is .geodesicArea() returns very close to what we see when calculating the same polygon in Desktop/Pro that's been projected to HARN NAD83 SP Florida East 901.&amp;nbsp; It's off by a couple of acres:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;geodesicArea(): 1400ac&lt;/P&gt;&lt;P&gt;Harn NAD 83: 1403ac&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am simply attempting to reproduce these results in the web application and was hopeful that using .planarArea() would produce the result above.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Nov 2021 16:24:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/area-calculation-in-planar-with-webmercator/m-p/1120455#M14654</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2021-11-26T16:24:34Z</dc:date>
    </item>
    <item>
      <title>Re: Area calculation in planar with WebMercator polygon</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/area-calculation-in-planar-with-webmercator/m-p/1120782#M14655</link>
      <description>&lt;P&gt;OK, I think I pulled this off. I did this some years ago, so bare with me.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For Planar setting, you have to use areasandlengthsparameters. Here's my example (sorry, codes not formatted right when I dropped it in..).&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;//&lt;A href="https://developers.arcgis.com/javascript/3/jsapi/areasandlengthsparameters-amd.html" target="_blank"&gt;https://developers.arcgis.com/javascript/3/jsapi/areasandlengthsparameters-amd.html&lt;/A&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;//&lt;A href="https://developers.arcgis.com/javascript/3/jsapi/areasandlengthsparameters-amd.html#calculationtype" target="_blank"&gt;https://developers.arcgis.com/javascript/3/jsapi/areasandlengthsparameters-amd.html#calculationtype&lt;/A&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;_getAreasAndLengthsParameters: function(geomArr) {&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;//&lt;A href="https://community.esri.com/message/274372?commentID=274372#comment-274372" target="_blank"&gt;https://community.esri.com/message/274372?commentID=274372#comment-274372&lt;/A&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;//&lt;A href="https://community.esri.com/thread/79094" target="_blank"&gt;https://community.esri.com/thread/79094&lt;/A&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;var areaLen = (this._isGeometryLine) ?&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;new LengthsParameters():&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;new AreasAndLengthsParameters();&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;if (this._isGeometryLine) {&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;areaLen.lengthUnit = GeometryService.UNIT_FOOT; //TODO GeometryService.UNIT_METER=9001 GeometryService.UNIT_FOOT = 9002 &lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;areaLen.polylines = geomArr;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;} else {&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;areaLen.lengthUnit = GeometryService.UNIT_METER; //TODO GeometryService.UNIT_METER=9001 GeometryService.UNIT_FOOT = 9002&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;areaLen.areaUnit = GeometryService.UNIT_ACRES;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;areaLen.polygons = geomArr;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;areaLen.calculationType = this._getAcreageCalculationType(); //preserveShape, geodesic, planar&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;//console.log("_getAreasAndLengthsParameters() areaLen = ", areaLen);&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;return areaLen;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;},&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;and how I&amp;nbsp; set it right before I used the geometry service to calculate it....&lt;/P&gt;&lt;P&gt;&lt;EM&gt;var areaLen = this._getAreasAndLengthsParameters(resultGeom);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;this._geomService.areasAndLengths(areaLen, lang.hitch(this, this._onAreasLengthsFinish), lang.hitch(this, this._onError, "areas"));&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Also, fyi: I noticed that the acreages came our slightly different when calculating it via Pro vs Desktop. My calculations matched one and not the other (I can't remember which one)..&lt;/P&gt;</description>
      <pubDate>Mon, 29 Nov 2021 14:28:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/area-calculation-in-planar-with-webmercator/m-p/1120782#M14655</guid>
      <dc:creator>KarenRobine1</dc:creator>
      <dc:date>2021-11-29T14:28:37Z</dc:date>
    </item>
  </channel>
</rss>

