[mapserver-dev] RFC: GMaps API for mapserv

Paul Ramsey pramsey at cleverelephant.ca
Thu Apr 10 14:11:15 EDT 2008


Hi devs,

Attached find an RFC for a new map generation mode for mapserv.cgi.
Interested in feedback I am. Mmmm.

Thanks!

P.
-------------- next part --------------
RFC #X: Direct tile generation for Google Maps API

== Overview ==

Using Mapserver to render data for use within alternate mapping systems is a growing use case.  A new access API could allow Google Maps users to overlay Mapserver data very simply and accurately.  Like the WMS API, the GMaps API will allow users to have a simple install'n'run option for serving data to a de facto standard user interface.

== Technical Solution ==

The GMaps API defines a GTileLayer which can be used as an overlay or base map.  The GTileLayer supports a GTileLayerOption, tileUrlTemplate, which allows the TileLayer to be accessed using a simple URL pattern that substitutes Google's x/y/z coordinates into the request:

 http://host/tile?x={X}&y={Y}&z={Z}.png

See:

 http://code.google.com/apis/maps/documentation/reference.html#GTileLayer

For Mapserver, the simple URL pattern would be:

 http://host/cgi-bin/mapserv?map=/path/to/amp&mode=gmap&gtile={X}+{Y}+X{Z}&layers=foo,bar

The change will add in new handling in the loadForm function for the mode and gmap parameters.  Like the WMS interface, GMaps API will require PROJ to be specified, and the existence of PROJECTION defines for all layers being accessed.  Google X/Y/Z coordinates will be converted to "spherical mercator" coordinates and fed into the extent.  The output projection will be set to "spherical mercator". 

The result will make a Google-with-Mapserver map as easy as:

 var myLayer = new GTileLayer(null,null,null,{ 
  tileUrlTemplate: 
'http://localhost/cgi-bin/mapserv?map=/foo.map&mode=gmap&gtile={X}+{Y}+{Z}', 
  isPng:true, 
  opacity:0.5 }); 
 var map = new GMap2(document.getElementById("map")); 
 map.addOverlay(new GTileLayerOverlay(myLayer)); 

The GMaps API will *not* attempt to address issues of meta-tiling or cross-tile labeling. The initial implementation will not attempt to address issues of cross-tile rendering artifacts, though we recognize that they could be a problem for some implementations.

== Mapscript Implications ==

None. This affects only the CGI interface and mapserv CGI.

== Files Affected ==

mapserv.c

== Backwards Compatibility Issues ==

None. This functionality is net new and requires to changes to existing behavior.

== Bug ID ==

None yet.

== Voting History ==

No vote yet.

== References ==

http://code.google.com/apis/maps/documentation/reference.html#GTileLayer


More information about the mapserver-dev mailing list