Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

areas_and_lengths Incorrect Default area_unit #106

Closed
bixb0012 opened this issue Jun 17, 2017 · 1 comment
Closed

areas_and_lengths Incorrect Default area_unit #106

bixb0012 opened this issue Jun 17, 2017 · 1 comment

Comments

@bixb0012
Copy link

According to the areas_and_lengths documentation:

If area_unit is not specified, then the units are meters.

Meters is not a valid areal unit. This appears to not just be a documentation issue but an actual code issue:

>>> from arcgis import gis, geometry
>>>
>>> gis = gis.GIS()
>>>
>>> geom_json = {
...     "rings": [[[0, 0], [0, 10], [10, 10],[10, 0],[0, 0]]],
...     "SpatialReference": {"wkid": 3857}
... }
>>>
>>> geom = geometry.Geometry(geom_json)
>>> geometry.areas_and_lengths(geom, "", "", "", 3857)
Error computing areas and lengths
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispython\lib\site-packages\arcgis\geometry\functions.py", line 85, in areas_and_lengths
    spatial_ref)
  File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispython\lib\site-packages\arcgis\_impl\tools.py", line 4596, in areas_and_lengths
    return self._con.post(path=url, postdata=params, token=self._token)
  File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispython\lib\site-packages\arcgis\_impl\connection.py", line 956, in post
    self._handle_json_error(resp_json['error'], errorcode)
  File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispython\lib\site-packages\arcgis\_impl\connection.py", line 976, in _handle_json_error
    raise RuntimeError(errormessage)
RuntimeError: Error computing areas and lengths
(Error Code: 500)
>>> 
>>> # override default "meters" with "square meters"
>>> geometry.areas_and_lengths(geom,"", "esriSquareMeters", "", 3857)
{'areas': [100], 'lengths': [40]}
>>> 
@achapkowski
Copy link
Contributor

@bixb0012 for areas_and_lengths all the values are required, and if not given properly they are expected to fail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants