Here is a quick function I did up, let me know if it works for you.
This works with Points, if you want to use LatLngs you would have to
modify it, but it would work the same.

-----------------------------------------------------------------------------------------------------------------------------

function getPointFromAngle(pt:LatLng, radius:Number, a:Number):Point {
        return new Point(pt.x + Math.cos(a) * radius, pt.y + Math.sin(a) *
radius);
}

function getPolygonForPath(pts:Array, radius:Number = 50):Array {
        var polygon_pts:Array = [];

        var a:Number = Math.atan2(pts[0].y-pts[pts.length-1].y, pts[0].x-pts
[pts.length-1].x);
        var pa:Number = a+3.14/2;

        for(var i:int = 0; i < pts.length; i++) {
                if(i == 0) {
                        polygon_pts.push(getPointFromAngle(pts[i], radius, 
Math.atan2(pts[i
+1].y-pts[i].y,pts[i+1].x-pts[i].x) - 3.14/2));
                } else if(i == pts.length-1) {
                        polygon_pts.push(getPointFromAngle(pts[i], radius, 
Math.atan2(pts
[i-1].y-pts[i].y,pts[i-1].x-pts[i].x) + 3.14/2));
                } else {
                        polygon_pts.push(getPointFromAngle(pts[i], radius, pa));
                }
        }

        for(i = pts.length-1; i >=0 ; i--) {
                if(i == 0) {
                        polygon_pts.push(getPointFromAngle(pts[i], -radius, 
Math.atan2(pts[i
+1].y-pts[i].y,pts[i+1].x-pts[i].x) - 3.14/2));
                } else if(i == pts.length-1) {
                        polygon_pts.push(getPointFromAngle(pts[i], -radius, 
Math.atan2(pts
[i-1].y-pts[i].y,pts[i-1].x-pts[i].x) + 3.14/2));
                } else {
                        polygon_pts.push(getPointFromAngle(pts[i], -radius, 
pa));
                }
        }

        polygon_pts.push(polygon_pts[0]);

        return polygon_pts;
}

-----------------------------------------------------------------------------------------------------------------------------

Jonathan
Scribblemaps.com

On Dec 18, 8:22 am, Moss <[email protected]> wrote:
> Hej,
>
> I'm having the same request. Instead of using a local solution I
> created a web service and used JTS to solve my problem. The "buffer"
> operation on a Geometry object will do exactly what you want.
> The ArcGIS API already has such a server build in the API but that
> requires you to use ArcGIS.
>
> http://www.vividsolutions.com/Jts/javadoc/com/vividsolutions/jts/oper...http://www.vividsolutions.com/jts/bin/JTS%20Developer%20Guide.pdf
>
> Good luck.
>
> On 26 nov, 16:48, Trikke <[email protected]> wrote:
>
>
>
> > Hi,
>
> > i'm fiddling around with the overlays and what i'm trying to achive is
> > to draw a big polyglon of a certain width around the polyline that was
> > drawn as a directions route between 2 locations.
> > Does anybody have some more info or a nice function/class for this to
> > generate such a fat polyglon around the route? I've tried playing with
> > the stroketickness but this only goes up to 255, which isn't big
> > enough unfortunately.
>
> > Thanks!
> > Trikke

--

You received this message because you are subscribed to the Google Groups 
"Google Maps API For Flash" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-api-for-flash?hl=en.


Reply via email to