Closed DShokes closed 8 years ago
I found a semi-workaround using the arcpy geometries.
>>> feature1.geometry.distanceTo(feature2.geometry)
4.4777
>>> # Using a geometryservice object
>>> geoservice.distance(sr=102100,geometry1=arcrest.geometry.Point(feature1.geometry,wkid=102100),arcrest.geometry.Point(feature2.geometry,wkid=102100))
{u'distance': 4.47213595499958}
I could say if the distance is below some number, that the points are the same. Unfortunately, this function doesn't seem to work when one feature has a wkid but the other feature has only wkt.
The distance function has parameter name "distanceUnit" which is supposed to take these Possible Values: meters | feet | kilometers | miles | nautical-miles | yards. When I try any of these, I get the same error.
>>> geoservice.distance(102100,arcrest.geometry.Point(feature1.geometry,102100),arcrest.geometry.Point(feature2.geometry,102100),distanceUnit='feet')
{u'error': {u'message': u'Unable to complete Distance operation.', u'code': 400, u'details': [u'The specified WKID (factory code) or WKT (definition string) is not a linear or angular unit.']}}
I can't tell if the distanceUnit error is a REST or ArcREST issue.
@DShokes - is this an ArcGIS Online or ArcGIS Server geometry service?
Usage Example:
pt1 = arcrest.common.geometry.Point(coord=[4,4], wkid=4326)
pt2 = arcrest.common.geometry.Point(coord=[5,5], wkid=4326)
print (gs.distance(sr=4236, geometry1=pt1, geometry2=pt2, distanceUnit=9036, geodesic=True))
Thanks @achapkowski , I didn't think to use an integer for distanceUnit or that the options were located in the ArcObjects documentation.
ArcRest or ArcRestHelper
ArcRest
Version or date of download
3.5.4
Bug or Enhancement
document examples for geometryservice functions
Repo Steps or Enhancement details
I have two features with the following geometries:
I'm trying to prove that they intersect given some amount of tolerance. I think intersect is the function I want to use, but I'm not certain. Perhaps I should be using generalize. I don't know the correct parameter syntax for this function either. Thanks,