|
POST
|
Trying to calculate acreage/area from polygon array loaded from JSON result of map service query and running into issue with geometries that contain "holes". From what I know, the first list of coordinate pairs (index 0) is the "outer" polygon, then all other coordinate pairs would be the interior rings. This is easiest enough to setup a condition to identify and calculate total area. For example area of a polygon with two interior rings could be determined by: ring[0] area - ring[1] area - ring[2] area = total area Got it. However, what if the polygon consists of 1 ring with interior rings and a ring coincident. That is, there are what looks like 2 polygons coincident to each other but one of them contains holes. How do I come up with the total area in this case? Example below shows 2 coincident polygons, 1 with holes that needs to have the area of interior rings subtracted from the overall ring, while the coincident polygon only has 1 ring that must be added to the total area. Edit: to simplify my question, how do I arrive at the count of 2 rings (area of 1 "island" ring, area 1 outer ring - total area of 7 interior rings) Here's the json for the rings in picture: {
"rings" : [
[
[
-8960520,
3141929
],
[
-8960482,
3141916
],
[
-8960381,
3141979
],
[
-8960297,
3142183
],
[
-8960220,
3142291
],
[
-8960267,
3142363
],
[
-8959212,
3142329
],
[
-8959216,
3140075
],
[
-8960546,
3141806
],
[
-8960599,
3141897
],
[
-8960692,
3142376
],
[
-8960637,
3142374
],
[
-8960622,
3142346
],
[
-8960608,
3142230
],
[
-8960516,
3142015
],
[
-8960520,
3141929
]
],
[
[
-8960049,
3141823
],
[
-8960001,
3141812
],
[
-8959983,
3141860
],
[
-8960017,
3141990
],
[
-8960058,
3142011
],
[
-8960083,
3141987
],
[
-8960049,
3141823
]
],
[
[
-8959472,
3141918
],
[
-8959391,
3141908
],
[
-8959340,
3141951
],
[
-8959320,
3142025
],
[
-8959325,
3142112
],
[
-8959387,
3142168
],
[
-8959484,
3142163
],
[
-8959513,
3142124
],
[
-8959472,
3141918
]
],
[
[
-8959828,
3142151
],
[
-8959808,
3142211
],
[
-8959826,
3142302
],
[
-8959875,
3142344
],
[
-8959943,
3142320
],
[
-8959986,
3142228
],
[
-8959959,
3142148
],
[
-8959927,
3142120
],
[
-8959858,
3142113
],
[
-8959828,
3142151
]
],
[
[
-8959663,
3141625
],
[
-8959585,
3141438
],
[
-8959535,
3141389
],
[
-8959428,
3141379
],
[
-8959399,
3141424
],
[
-8959384,
3141551
],
[
-8959497,
3141761
],
[
-8959571,
3141760
],
[
-8959663,
3141625
]
],
[
[
-8959960,
3141599
],
[
-8960028,
3141615
],
[
-8960074,
3141591
],
[
-8960098,
3141499
],
[
-8960095,
3141436
],
[
-8960049,
3141324
],
[
-8960008,
3141263
],
[
-8959800,
3141169
],
[
-8959793,
3141018
],
[
-8959741,
3140928
],
[
-8959722,
3140834
],
[
-8959630,
3140750
],
[
-8959570,
3140741
],
[
-8959528,
3140782
],
[
-8959542,
3140877
],
[
-8959601,
3141041
],
[
-8959719,
3141213
],
[
-8959733,
3141325
],
[
-8959797,
3141385
],
[
-8959960,
3141599
]
],
[
[
-8959346,
3140751
],
[
-8959388,
3140703
],
[
-8959379,
3140596
],
[
-8959479,
3140586
],
[
-8959518,
3140560
],
[
-8959514,
3140503
],
[
-8959403,
3140475
],
[
-8959393,
3140355
],
[
-8959278,
3140327
],
[
-8959249,
3140351
],
[
-8959237,
3140406
],
[
-8959333,
3140479
],
[
-8959343,
3140579
],
[
-8959291,
3140665
],
[
-8959296,
3140732
],
[
-8959346,
3140751
]
],
[
[
-8960421.4573999997,
3141207.5951999985
],
[
-8960651.4805999994,
3140355.0742999986
],
[
-8960730.3613000009,
3140457.7377999984
],
[
-8960501.8148999996,
3141210.1849000007
],
[
-8960421.4573999997,
3141207.5951999985
]
]
]
}
... View more
02-04-2022
11:01 AM
|
0
|
5
|
1349
|
|
POST
|
All of our map services are sourced as Web Mercator Aux Sphere projection. 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. 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. It's off by a couple of acres: geodesicArea(): 1400ac Harn NAD 83: 1403ac I am simply attempting to reproduce these results in the web application and was hopeful that using .planarArea() would produce the result above.
... View more
11-26-2021
08:22 AM
|
0
|
1
|
1993
|
|
POST
|
Last attempt with cleaned up compare checker. Results in console: sqFtGeodesic: 61138987.116298884 sqFtPlanar: 7273987.501667344 Code: 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)
... View more
11-23-2021
11:39 AM
|
0
|
0
|
2013
|
|
POST
|
Init attempt shows odd results. WKID: 102658 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: 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) Areas calculated: 1. ArcGIS Desktop 10.8.1: 61133457.122888 2. planarArea() Javascript: 7273987.555021531
... View more
11-23-2021
07:45 AM
|
0
|
0
|
2026
|
|
POST
|
JS 3.x 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? I am currently determining acreage value calculations with this function that implements esri.geometry.geodesicAreas but we see a discrepancy in values when we use ArcGIS Desktop and apply a planar projection to the same boundary. 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
}, I think I'm simply looking for examples of applying a State Plane projection to the input geometry and calling planarAreas() instead.
... View more
11-23-2021
06:02 AM
|
0
|
5
|
2064
|
|
POST
|
This is resolved. My fault: I had using AdminTools to "copy" the complex feature service in question but it didn't actually copy everything and the "export" option simply unavailable on that particular item. The Notebook appears to run successfully on a valid item.
... View more
11-17-2021
01:11 PM
|
0
|
0
|
1792
|
|
POST
|
Hi I am attempting to export a hosted feature server to a FGDB for later download but running into errors. KeyError Traceback (most recent call last)
<ipython-input-34-c3c8826240dd> in <module>
21 print (exportName)
22
---> 23 data_item.export(exportName, "File Geodatabase")
/opt/conda/lib/python3.7/site-packages/arcgis/gis/__init__.py in export(self, title, export_format, parameters, wait, enforce_fld_vis, tags, snippet, overwrite)
8776 params['exportParameters'] = {"enforceFieldVisibility" : enforce_fld_vis }
8777 res = self._portal.con.post(data_path, params)
-> 8778 export_item = Item(gis=self._gis, itemid=res['exportItemId'])
8779 if wait == True:
8780 status = "partial"
KeyError: 'exportItemId' The code runs fine on a simple hosted service, but fails with error above when run on a feature server with multiple service layers and tables. #import modules
from arcgis.gis import GIS
from arcgis.features import manage_data
import time, os, fnmatch, shutil
from pathlib import Path
#gis = GIS(username="Username", password="Password")
gis = GIS("home")
item_id = '564d5e1840b44ab1b6f4083cfaaf7928'
#item_id = '22b8d8af9b0842ffa622a73655946146'
data_item = gis.content.get(item_id)
data_item.title
itemName = gis.content.get(item_id).title
fgdb_title = itemName
t = time.localtime()
timestamp = time.strftime('%b%Y',t)
exportName = "{}_Download{}".format(itemName, timestamp)
print (exportName)
data_item.export(exportName, "File Geodatabase")
... View more
11-17-2021
11:31 AM
|
0
|
1
|
1840
|
|
POST
|
Thanks Russell... I'd have to open a premium ticket in order to not show on public forum (which I can do). In the meantime, I can provide dev tools output that may give you some intel to help resolve:
... View more
07-28-2021
09:48 AM
|
0
|
1
|
1218
|
|
POST
|
When attempting to open the Custom Label expression building dialog in the new map viewer, clicking the icon on 1 of the layers does not open it: For other layers it does open: Is there something specific to the layer that prohibits this dialog from opening?
... View more
07-28-2021
09:03 AM
|
0
|
3
|
1235
|
|
POST
|
WAB Developer 2.19 Launchpad Theme Still dealing with caching of a deployed Web AppBuilder app anytime changes are made and is redeployed. THIS thread actually solved the main problem, however it only solves it if the url is navigated to from a regular browser window. Unfortunately, the way this particular WAB app is opened (a link on another non-ESRI web application) is navigated to as a popup window. From what I know, the developers are navigating to this WAB via window.open() While the cached version is dealt with, I think the index.html conatains css that causes the window to look broken. Any recommendations?
... View more
07-20-2021
08:37 AM
|
0
|
0
|
500
|
|
POST
|
Robert this looks like it will be the winner on this issue. I had a strange result when I tested but since I redeployed again the initial testing is promising and just need users to validate. Thanks for the tips.
... View more
07-12-2021
12:26 PM
|
0
|
0
|
2754
|
|
POST
|
I then tried to update the index.html with this, <script type="text/javascript" src="env.js?1"></script> Which seemed to do something! I can see the Bookmarks widget and I didn't get the error as before but now the WAB loads weird like top of the page is split.
... View more
07-09-2021
09:57 AM
|
0
|
0
|
2797
|
|
POST
|
I took one of our dev WABs with custom widgets and updated the env.js file line #83 with your suggestion: deployVersion = '2.19.20210709'; I added the Bookmarks widget to the WAB app, redeployed it and navigated to the app and this is what shows when it opens: Inspecting the env.js that got loaded, line 83 shows the cached version not what I changed it to. If I use incognito browser window (Chrome) it opens just fine with the Bookmarks widget!
... View more
07-09-2021
09:40 AM
|
0
|
1
|
2797
|
|
POST
|
I see. The issue I have is I included a bit of code in the WidgetManager.js to attempt to deal with caching. Anytime I redeploy a WAB with custom widgets this cache issue rears its head and telling users to clear browser cache or use incognito window (both work) is not an acceptable solution. I updated the _tryLoadWidgetConfig function in the WidgetManager.js with this, _tryLoadWidgetConfig: function (setting) {
var def = new Deferred();
//need load config first, because the template may be use the config data
if (setting.config && lang.isObject(setting.config)) {
//if widget is configurated in the app config.json, the i18n has beed rocessed
def.resolve(setting.config);
return def;
} else if (setting.config) {
if (require.cache['url:' + setting.config]) {
def.resolve(json.parse(require.cache['url:' + setting.config]));
return def;
}
var configFile = utils.processUrlInAppConfig(setting.config);
// The widgetConfig filename is dependent on widget label,
// IE8 & IE9 do not encode automatically while attempt to request file.
var configFileArray = configFile.split('/');
configFileArray[configFileArray.length - 1] =
encodeURIComponent(configFileArray[configFileArray.length - 1]);
configFile = configFileArray.join('/');
//Append date to ensure you get the latest json file
configFile += "?currentVersion=" + Date.now();
return xhr(configFile, {
handleAs: "json",
headers: {
"X-Requested-With": null
}
});
} else {
return this._tryLoadResource(setting, 'config').then(function (config) {
//this property is used in map config plugin
setting.isDefaultConfig = true;
return config;
});
}
}, However, the WidgetManager.js file itself is being cached. So I hoped to apply something to whatever loaded this to force a new version to be loaded each time.
... View more
07-09-2021
06:37 AM
|
0
|
5
|
2819
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 02-17-2020 10:47 AM | |
| 1 | 10-25-2022 11:46 AM | |
| 1 | 08-08-2022 01:40 PM | |
| 1 | 02-15-2019 08:21 AM | |
| 2 | 08-14-2023 07:14 AM |
| Online Status |
Offline
|
| Date Last Visited |
01-22-2025
02:28 PM
|