2
votes

I'm working on a project where I am utilizing tile overlays (visual) to display a rendering of the space, building names, accessibility, and parking spaces as well as KML polygons (functionality) to allow the user to click on various buildings or points of interest to bring up further information. My current issue lies in the organization of these various elements.

At the moment, the KML polygons are appearing above all the tile overlays, including building names and parking which I would prefer to be on top of the KML polygons as they are otherwise partly obscured by the polygons. In short, here is the current layering:

  • KML Polygons
  • Building Names (Transparent)
  • Accessibility (Transparent)
  • Parking (Transparent)
  • Space Rendering (Opaque)
  • Google Maps

Ideally, I would prefer to have the KML polygons appear within these tile overlays, namely right above the rendering of the space. Thus, I wish to obtain this layering:

  • Building Names (Transparent)
  • Accessibility (Transparent)
  • Parking (Transparent)
  • KML Polygons
  • Space Rendering (Opaque)
  • Google Maps

Is there anyway to rearrange the KML the tile overlay layers to achieve this?

Tile Overlays:

map.overlayMapTypes.insertAt(0, renderMapType);
map.overlayMapTypes.insertAt(1, parkingMapType);
map.overlayMapTypes.insertAt(2, accessMapType);
map.overlayMapTypes.insertAt(3, nameMapType);

Edit:

Allow me to explain the map a bit more clearly.

When Google Maps is in "Map", the rendering is displayed and most of the KML polygons are invisible, those unrepresented on the render remaining visible so that the user is still aware of their presence. When Google Maps is in "Satellite", the rendering isn't displayed and all the KML polygons are visible and overlay their respective elements on the satellite image, making them easier for the user to see.

In either case, the accessibility, parking, and name overlays can be used and, as there is always at least some KML polygons which must be visible, I've resorted to looking for a way to reorder the layers.

2
Since you are using the KML to handle mouse clicks, won't this cause many of the clicks to be lost? Do the Building Names, Accessibility, and Parking layers handle mouse clicks?Sean Mickey
@SeanMickey The KML elements allow the user to click the buildings or points of interest on the map and bring up further information on the object. As far as I know, the three other layers do not as they are simple tile overlays which add visual information to the map.Nick Mischler

2 Answers

1
votes

To actually change the layer ordering, you'll need to use a custom tile overlay and place it in the proper pane. This is the implementation I authored which is free to use. Most of the features it was created for now exist in the maps API.

http://search.missouristate.edu/map/mobile/examples/tileoverlay.htm

You'll probably need to adjust in which pane the overlay gets drawn. Here's the applicable source line:

this.getPanes().mapPane.appendChild(this.settings.div_);
1
votes

You cannot easily change the layer ordering, but you can use transparent polygons in your KML to get the same effect.