How to: Location accuracy circle intersect with feature layer

645
1
08-14-2018 08:32 AM
CharlesLoftis
New Contributor III

Working with ArcGIS Android's 100.x API, 

I'm a bit of a newbie with ArcGIS so forgive any incorrect use of terminology. 

BACKGROUND

I am developing an app that must work in a completely offline environment. All maps (in this case they will be mobile map packages) are downloaded to devices before going offline. Each mmpk will have a feature layer containing a closed polygon. I need to be able to determine if my current location is within the polygon feature. That has proven to be easy enough using "GeometryEngine.within()". 

PROBLEM

The problem that I'm having is with an additional requirement: I also need to determine if the current location's accuracy circle insects with the polygon's boundary to indicate that the user "may be" within the feature's boundaries - think of it as a stoplight: green==inside, red==outside, yellow==close to the polygon boundary.

I see that the GeometryEngine has methods like crosses, intersects, overlaps, touches, etc., but I don't know how to pass a circle representing the location's accuracy as a geometry. Suggestions?

0 Kudos
1 Reply
CharlesLoftis
New Contributor III

I've made progress on this - I was able to use the GeometryEngine's buffer()/bufferGeodetic() methods to create a polygon (p) representing the location's accuracy circle.

Polygon p = GeometryEngine.bufferGeodetic(
   GeometryEngine.project(location.getPosition(), feature.getGeometry().getSpatialReference()), 
   location.getHorizontalAccuracy(), new LinearUnit(LinearUnitId.METERS), Double.NaN, GeodeticCurveType.GEODESIC);

Next I was able to pass polygon (p) into the GeometryEngine's overlaps() method but I'm having problems getting the units converted properly and/or polygon to represent a circle on my map:

Problems

  • GeometryEngine's buffer() - not sure how to get the correct unit distance passed into buffer() method - is there a way to convert meters into the feature layer's units (angular)?
  • GeometryEngine's bufferGeodetic - works well but when I add the resulting polygon to my graphics layer the shape is an ellipse (for all the GeodecticCurceTypes) vs a circle (what I expected, maybe wrongly?). Is the ellipse shapred polygon a result of the feature layer's units being angular and/or the spatial reference's (wkid=4329, GCS_North_American_1983) geographic projection?
0 Kudos