On Oct 4, 6:00 am, spoco2 <[email protected]> wrote:
> Hi all,
>
> I am at a loss as to how to neatly define a complex path polygon/
> polyline (think a postcode boundary) in V3 of the API compared to V2.
>
> We have an app that currently uses the V2 API to draw about 50 complex
> polygons at a time on a map. This we do using encoded polygons. So one
> complex polygon could be represented as:
>
> "d{xefubzsz`bquxn{hlzu`...@jfcuro@c...@jn@b...@prbo@y|
> @l[ygi...@zat@mnq^diqiblzas...@}erf}eaho@kUrAdH"
>
> for example. That's a lot of points in a nice, concise string.
>
> Now, in V3 I see there is no such GPolygon.fromEncoded() method, and
> instead we are supposed to define polygons via code like:
> var coords= [
> new google.maps.LatLng(25.774252, -80.190262),
> new google.maps.LatLng(18.466465, -66.118292),
> new google.maps.LatLng(32.321384, -64.75737),
> new google.maps.LatLng(25.774252, -80.190262)
> ];
>
> Which, for that very example above turns out like as a few pages of
> this editbox full of 'new google.maps.LatLng' definitions. This seems
> horrendously inefficient.
>
> I know I can send them as purely an array of points and then on the
> client step over that doing the same, but that seems just as bad.
>
> Surely there is a more effiecient way of defining a complex polygon
> now?
You might find:
http://www.polylib.us/polycluster/coast/encoded.html
to be useful. It uses classic "fromEncoded" polys. It uses the
"points" string. It ignores the "levels" string. It could be
combined with:
http://www.polylib.us/gx
to build a client-side KML processor.
--
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 [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-js-api-v3?hl=en.