I'm trying to bulk calculate acres for polygons in a hosted feature service using ArcGIS Online Notebook Standard (no ArcPy)
Is there a bug in the ArcGIS Online Notebook (API v1.8.4 at posting time) implementation of the arcgis.geometry.areas_and_lengths() function or is the API description missing vital information?
Through a lot of trial and error I figured out a set of parameters that ArcGIS Online Notebook would accept
I could only get it to work with parameters formatted the following way:
from arcgis.geometry import lengths, areas_and_lengths, project
from arcgis.geometry import Point, Polyline, Polygon, Geometry
# create a JSON polygon geometry
geom_json = {"rings" : [[[0, 0], [0, 10], [10, 10],[10, 0],[0, 0]]],
"spatialReference" : {"wkid" : 4326}}
# create Geometry object
test_geom = Geometry(geom_json)
# calculate areas_and_lengths
areas_and_lengths(test_geom, 9035, {"areaUnit" : "esriAcres"}, "geodesic", 4326, None, False)
I welcome any suggestions on a more efficient way to calculate acres than one by one converting a Feature into a Geometry to then run areas_and_lengths().
Without using ArcPy though 🙂
edit: fixed typos
Perhaps raise an "issue" on their github site... they don't visit much here.
ArcGIS API for Python (github.com)
Thx @DanPatterson! Posted a bug report on github.
BTW: do you have any suggestions on a better way to bulk calculate feature acres in Esri Python API? Perhaps even with ArcPy?
you can access all the tools in arctoolbox if you have arcpy