Test link: http://kwestievan.nl/reizen
What I'm doing here: implemented my own OverlayView to draw curved lines from marker to marker with arrowheads at the end of each line with SVG. I add a div element to the map that is of a certain width and height to contain the line and arrowhead. I then put inline SVG code in that div to let the browser draw the line and arrow.
If viewed in Safari or Chrome some very annoying and unexpected behavior occurs. In Safari the whole SVG graphic disappears beyond a certain zoom level, and in Chrome the arrowheads at the end of the line disappear and re-appear at random zoom levels so it seems. In Firefox and Opera this behavior is not happening and the arrowheads are visible at any zoom level.
Don't mind the red boxes and/or the displacement of some arrows. That's work in progress.
What is going on here? Is SVG not fully compatible with Google Maps or am I doing something wrong?
ps: I know it was announced that tech support was moved to SO, but thought that I might as well post it here since a lot of tech people are also hanging around here. Here's the link to SO: http://stackoverflow.com/questions/9603353/google-maps-api-v3-svg-graphics-clip-disappear-when-zooming
You are running out of precision. When zooming control the size of the numbers you are drawing. Each zoom increase the precision in 2. So high zooms are 2^zoom. SVG will have an overflow. You need to clip your content.
--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-maps-js-api-v3/-/nf-iY5Vn6wIJ.
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.
Sorry. Your SVG overlay must have some coordinates. For example you say, I want to draw a path from 10,10 to 15,20. Now imagine that 10,10 is Sydney and 20,20 is New York. If you are in zoom level 0, you will have 10,10 and 20,20. In level 1, it would be 20,20 for Sydney and 40,40 for New York. In level N, 2^N*(10,10) and 2^N*(20,20). So, how big is you SVG size? is is the size of the "screen" or the size of the "map"? If it is the size of the map, you have a SVG of 2^24 (max zoom) "pixels" by the size of a tile (2^8). Can you imagine that? You have an SVG of 2^32 pixels. Think how things go inside the browser, having to manage all those "big" numbers is very easy to run into overflow.
Have you considered using the API to draw your polys ? You could draw
your arrows in an "OverlayView". You could use CANVAS rather than
SVG. I believe every common browser with support for SVG also has
support for CANVAS.
I suggest using Berry's approach: