[Geoserver-users] Changes of wms-gs-1_0_0.js for different map names

Hello list.

This information is useful for those working with GeoServer WMS layers into
Google Maps.

Finally I supposed a workaround to let wms-gs-1_0_0.js script work with more
than one map in the same page.

Description
-------------------
wms-gs-1_0_0.js script had hardcoded the name of map "map":

if (this.myMercZoomLevel!=0 && map.GetZoom < this.myMercZoomLevel) {

When you create a new map with google maps with other name than "map":

var map = new GMap(document.getElementById("abettermapname"));

javascripts fails....

Workaround
Pass the map name to the CustomGetTileUrl into wms-gs-1_0_0.js and eval this
variable to get the actual zoom.

This is useful to put more than one map in the same page:

var map = new GMap(document.getElementById("map1"));
...
var map = new GMap(document.getElementById("map2"));
...

Now we need to pass a new var:
tileCountry.myMapName='abettermapname';

I've attached a modified version of wms-gs-1_0_0.js called wms-gs-1_0_1.js
containing these changes.

I will commit this changes to the Drupal Gmap module, which uses different map
names frequently (usermap,nodemap,locatiomap...)

Eduin

__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
Regístrate ya - http://correo.espanol.yahoo.com/

wms-gs-1_0_1.js (4.73 KB)