Google maps as a Mapserver interface

Norman Barker nbarker at RSINC.COM
Thu Jul 14 04:14:45 EDT 2005


Attached is a stylesheet to take a layer from a WMS and put it in Google Earth (I did
this very quickly, so it isn't that polished).

The only required parameter is layer so if you have capabilities document on disk the use
with Xalan is
java -cp lib\xalan.jar;lib\xercesImpl.jar;lib\xml-apis.jar org.apache.xalan.xslt.Process -XSL earthWMS.xsl -IN wms_capabilities.xml -PARAM layer global_mosaic -OUT result.kml 

I tested it with the OnEarth global mosaic.

Hope you have fun,

Norman

-----Original Message-----
From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU]On
Behalf Of Antti Roppola
Sent: Thursday, July 14, 2005 6:19 AM
To: MAPSERVER-USERS at LISTS.UMN.EDU
Subject: [UMN_MAPSERVER-USERS] Google maps as a Mapserver interface


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();
});
-------------- next part --------------
A non-text attachment was scrubbed...
Name: earthWMS.xsl
Type: application/octet-stream
Size: 2609 bytes
Desc: earthWMS.xsl
Url : http://lists.osgeo.org/pipermail/mapserver-users/attachments/20050714/813a180e/earthWMS.obj


More information about the mapserver-users mailing list