Sunday, November 16, 2008

Polygon and Geodetic Circle Draw Tool

In this sample, I'm demonstrating how to roll you own draw tool using the Flex API for ArcGISServer. I'm attaching mouse listeners to the map and based on the selected tool, I'm drawing a polyline, a circle or a geodetic circle. For the latter, I'm using the undocumented (subject to changes) ProjUtils class to enable me to calculate the distance in meters between two lat/lon values. In addition, this class has the capability to calculate a lat/lon value for a given lat/lon origin, radius and azimuth. When using this sample, watch out for boundary condition (too close to the poles or crossing the date line) as this is a very simple implementation. How to handle these conditions will be another post :-) as usual, you can download the source from here. Have fun, and hope to see some of you at MAX next week.

5 comments:

Gus Leo said...

Wonderful
Why if I use draw circle and when i zoom in or zoom out the size of this circle isn't change.Not like if I use geodetic...

Regars,


Gus Leo

ThunderHead said...

Because the Circle distance is based on pixel value, vs Geodetic is based on a "true" distance.

Gus Leo said...

So how i can use Geodetic, because an error program because ProjUtils class isn't include..How i can get ProjUtils class???

huiyi said...

hi this is interesting. i'm trying to run your sample, but there are errors whether agslib-1.0-2008-10-22.swc or agslib-1.1-2009-01-21.swc
is used. would appreciate some advice on this?

ThunderHead said...

I've updated the source code to include the Geodetic code - in addition, u need to get the flex api for ags swc from www.esri.com/flex. Hope that helps.