Google maps as a Mapserver interface

Antti Roppola ajr at BRS.GOV.AU
Wed Jul 13 22:19:25 PDT 2005


Hi all,

Has anybody looked at using Google maps as a UI for Mapserver or WMS? I
had a look through the API and ended up re-purposing the marker PNG sice
there was no apparent way of importing base layers different to those
Google provides.

I'll post a URL once I start experimentally serving some data in the same
projection as Google's base and fix up a few warts in the example, i.e. it
Currently doesn’t clean up after itself or handle zoom events properly.

WFS ought to be a case of an XSLT to munge features into Google's format.

Cheers,

Antti


var map = new GMap(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.centerAndZoom(new GPoint(139.2, -34), 9); function importMS() {
  map.removeOverlay(marker);
  var bounds = map.getBoundsLatLng();
  var myxmax = bounds.maxX;
  var myymax = bounds.maxY;
  var myxmin = bounds.minX;
  var myymin = bounds.minY;
  var myext = '&mapext=' + myxmin + '+' + myymin + '+' + myxmax + '+' +
myymax;

  var icon = new GIcon();
  var mapserv = 'http://www.some.mapserv/url' + myext;
  var markershadurl
= "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
  icon.image = mapserv;
  icon.shadow = markershadurl;
  icon.iconSize = new GSize(500,400);
  icon.shadowSize = new GSize(22,20);
  icon.iconAnchor = new GPoint(250,200);
  icon.infoWindowAnchor = new GPoint(5,1);

  var marker = new GMarker(new GPoint((myxmin + ((myxmax - myxmin)/2)),
(myymax - ((myymax - myymin)/2))), icon);
  map.addOverlay(marker);
}
importMS();

GEvent.addListener(map, "moveend", function() {
  importMS();
});



More information about the MapServer-users mailing list