How to draw a polygon with encoded levels

472 views
Skip to first unread message

Stefano Tucci

unread,
Jun 28, 2011, 2:51:16 AM6/28/11
to google-map...@googlegroups.com
How to draw a polygon by encoded polyline, and encoded levels?
In documentation i don't see how to do it...


I can draw a polygon from encoded polyline..
Passed argument "ret" its like this:
{"polylines" : [ {"polyline":"EncodedPolyline", "polygonNumber":1, "EncodedLevels": "MYENCODEDLEVELS"} ] } 

function PolylineToDraw(ret)
{
    var obj = eval("(" + ret + ")");
    var mpaths = [];
    var last = 1;
    for(i=0; i<obj.polylines.length; i++)
    {
        mpaths.push(google.maps.geometry.encoding.decodePath(""+obj.polylines[i].polyline));
        if(last != obj.polylines[i].polygonnumber || i+1>=obj.polylines.length)
        {
            var cc = new google.maps.Polygon({
                paths: mpaths,
                strokeColor: "#0000FF",
                strokeOpacity: 0.8,
                strokeWeight: 2,
                fillColor: "#0000FF",
                fillOpacity: 0.35
            });
            cc.setMap(map);
            last = obj.polylines[i].polygonnumber;
            mpaths = [];
        }
    }
}

How to include Encoded Levels in drawing?


--
Stefano Tucci

Chris Broadfoot

unread,
Jun 28, 2011, 2:53:25 AM6/28/11
to google-map...@googlegroups.com
Check out the encoding/decoding functions here:

--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.
To post to this group, send email to google-map...@googlegroups.com.
To unsubscribe from this group, send email to google-maps-js-a...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Ben Appleton

unread,
Jun 28, 2011, 2:58:34 AM6/28/11
to google-map...@googlegroups.com
Maps API v3 computes the levels in JavaScript, so you don't need to provide them yourself.

- Ben

On Tue, Jun 28, 2011 at 4:51 PM, Stefano Tucci <stefano...@gmail.com> wrote:
--

Pontino

unread,
Jun 28, 2011, 2:59:39 AM6/28/11
to google-map...@googlegroups.com
Thanx, i know the encoding/decoding functions... But how to pass encoded levels to Polygon class? There are an argument like "levels" ?

Or I pass it in the paths argument of the polygonOptions argument?

Pontino

unread,
Jun 28, 2011, 3:04:06 AM6/28/11
to google-map...@googlegroups.com
Thanx
Reply all
Reply to author
Forward
0 new messages