Custom Tile Layer (SVG based) on Alternate Pane...

326 views
Skip to first unread message

Garthan

unread,
Aug 26, 2011, 9:52:57 PM8/26/11
to google-map...@googlegroups.com
I am building a tiled svg layer and would like the layer to catch click events and mouse overs and things of that sort.
I have succeeded in getting a Overlay Map Type to work but the SVG element itself doesnt recieve mouseovers or clicks.

Based on forum reading I was thinking I might need to use an OverlayView and hang the layer from the  overlayMouseTarget Pane

I am reticent about having to write the fairly elaborate draw function on an OverlayView and was hoping for a short cut? 

Any ideas?

Esa

unread,
Aug 27, 2011, 6:41:16 PM8/27/11
to Google Maps JavaScript API v3
Assuming that you can easily generate a 'hot spot' file from your SVG.
You can read the mouse coordinates by 'mousemove' event and compare
those to hot spots.

Garthan

unread,
Aug 29, 2011, 10:46:04 AM8/29/11
to Google Maps JavaScript API v3
hmmm I can readily snag for instance the the string of coordinates
within the svg I am sure...
but they are defined as a series of relative positions within svg
space and so on (not really a pretty
thing to translate when under the hood the browser will do it if the
events are allowed to reach it)
the data is pretty complex - geologic and soil maps for instance...
and it loads very fast (with shape
data being smaller even than pngs usually) SVGs have a lot of
potential interactivity.. can be mouse over highlighting
tool tips are just one element... Though getting an info window
ballooon off of an on click... is probably even more
the short term goal.

polylib

unread,
Sep 18, 2011, 8:40:39 PM9/18/11
to Google Maps JavaScript API v3
It is a bug. The defaultUI prevents mouse events from reaching the
"overlayLayer" pane.

Try:

streetViewControl:false;useStaticMap:false;

CANVAS is faster than SVG. CANVAS requires fewer event listeners than
SVG. "Point in Poly" analysis can be performed directly with CANVAS
elements.

polyarc

unread,
Sep 18, 2011, 4:40:40 PM9/18/11
to Google Maps JavaScript API v3

Garthan

unread,
Oct 26, 2011, 5:25:13 PM10/26/11
to google-map...@googlegroups.com
It sure seems like a bug to me too.

Are you suggesting that I put the data as say js files that get loaded and executed on to a canvas?

Enoch Lau (Google Employee)

unread,
Oct 26, 2011, 7:26:55 PM10/26/11
to google-map...@googlegroups.com
http://code.google.com/apis/maps/documentation/javascript/reference.html#MapPanes

Description of overlayLayer:
This pane contains polylines, polygons, ground overlays and tile layer overlays. It may not receive DOM events. (Pane 1).

Garthan

unread,
Nov 23, 2011, 10:28:23 AM11/23/11
to google-map...@googlegroups.com
Thought I would show an example of the SVG tiles loading (though the example is a tad heavy)
http://www.microimages.com/geodata/TownsendGeologySVGZ/TownsendGeologySVGZ.htm
Reply all
Reply to author
Forward
0 new messages