On Mar 14, 8:26 pm, Brak <[email protected]> wrote:
> Yes. I understand SVG isn't supported by all browsers. I'm not
> interested in putting SVG directly on the web page at all. I'm talking
> about using the SVG file format to store google maps polygon
> coordinate points externally from my javascript code. The SVG file
> would be parsed and each <polygon> in the file would be rebuilt and
> reconstructed on the map as a google.maps.Polygon(). Google Maps
> Polygons support are not dependent on a browser's native SVG support.
> When the Maps API receives a google.maps.Polygon it creates SVG for
> browsers that support it, it creates VML objects if the client is
> using IE, and if the browser doesn't support SVG at all, it sends the
> request to the tile server and receives image tiles back. Native SVG
> support for browsers is irrelevant in terms of what I'm talking about.
> I'm only wanting to store the *points* to my polygons in the SVG file,
> which are used to create google.maps.Polygon() objects for the API.
>
> I was curious if anyone had tried this method, had written anything in
> v3 code already, or had any tips or understanding of the SVG format
> that may make it easier to write.

I suppose you could do it but it would be very inefficient.  The "svg"
element has a "path" child element.  The "d" attribute of the "path"
subelement describes the shape in PIXELS for a specific zoom level,
not in Lat/Lon coordinates.  The API expects Lat/Lon coordinates.  You
will have to do the conversion.

The "path" offsets can be either "absolute" or "relative" depending on
whether upper case "M" & L" or lower case "m" & "l" directives are
used.  The directives can be mixed in the same path but it is not
common.  The "M" or "m" directives are "moveTo" commands.  The "L" or
"l" directives are "lineTo" commands.  Each directive is followed by a
pair of X & Y PIXEL offsets.

You could parse an SVG file but it would be painful.  JSON or XML with
Lat/Lon coordinates rather than pixel coordinates will be faster &
easier.

-- 
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.

Reply via email to