How to draw an arc within a feature layer?

520
4
02-10-2012 07:40 AM
SarahBurgin
New Contributor
I'm using ArcGIS API for Flex 2.4 and need to draw an arc within a FeatureLayer (in this context meaning part of a circle, between two known angles, having specific centre in map co-ordinates and a diameter in kilometres).

Can anyone help please?

I don't have access to services to assist with this, but as a possible starting point did find some code that appears to attempt to define a circle by extending the Polygon class:
http://proceedings.esri.com/library/userconf/devsummit09/papers/advancedflexapplications.pdf (slides 13 onwards)

Unfortunately, this appears to use a method Utils.geodeticDirect(...) however that doesn't seem to exist in the API, so I'm unable to get it working as published and haven't found a way to fix it. I'm also informed that <geodetic.Circle> as the declaration isn't resolved to a component implementation. Maybe the approach in that presentation is too far out-of-date and no longer supported?

Thanks in advance for any ideas that you can suggest!
Tags (2)
0 Kudos
4 Replies
SarahBurgin
New Contributor
For what it's worth, I found a solution to the missing geodeticDirect() method by working around it using MapPoint.offset(x,y) instead!

Still haven't solved the compiler being unable to resolve the new component to its implementation, but for the moment I'm back to working with just 1 class, to avoid that issue.
0 Kudos
SarahBurgin
New Contributor
It appears that I still have a problem with this task afterall.

I'm calculating each MapPoint on the arc's Polygon using:

centrePoint.offset(Math.cos(angleInRadians) * radiusInMeters, Math.sin(angleInRadians) * radiusInMeters)

However the arc doesn't have the correct scale (i.e. they're not seen on the map at the correct distance from the centre point) and I don't know what's wrong. I've set the units property of the GraphicsLayer to com.esri.ags.Units.METERS yet they're still about 40% too small.

Can anyone suggest what the problem is please?
0 Kudos
SarahBurgin
New Contributor
Here's the solution - the arc radius meeds to be divided by Math.cos(centrePoint.latitude * PI_OVER_180) and then scales correctly!
0 Kudos