This patch adds Web Map Services (WMS) support to gmap module. You can add custom maps with WMS layers.

Features

  • Adds WMS support to gmap module
  • You can insert WMS layers as Google Maps "custom maps" types
  • You can select overlay your WMS layers with "map", "satellite" or "hybrid" into the custon map
  • You can add one or more copyright messages

    ToDo

  • Support to WMS into the tag parser
  • John Deck's Script and Chris Holmes version of the same script, do a call to "map.getZoom()". gmap supports more than one map per page, with a different name than "map". We need figure how to send this map name to CustomGetTileUrl function...

    Sample code

    $mymarkers=array(
    array('markername'=>'blue',
          'label' => 'Terminal bus stop',
          'point' =>'49.19236205396474,-123.1790542602539',
          ),
    array('markername'=>'green',
          'label' => 'Service buildings bus stop',
          'point' =>'49.19224986943509,-123.1538200378418',
          ),
    array('markername'=>'green',
          'label' => 'Transer to Vancouver bus',
          'point' =>'49.191801128772326,-123.14231872558594',
          ),
    );
    
    $myfeeds=array(
    array('url'=>'http://earthquake.usgs.gov/recenteqsww/catalogs/eqs7day-M5.xml',
          'markername'=>'yellow',
          )
    );
    
    $mywmss=array(
    array('name'=>'WMS',
          'url'=>'http://chignik.berkeley.edu/cgi-bin/mapserv440?map=/usr/local/web/html/google/wms.map&',
          'format'=>'image/gif',
          'minResolution'=>'1',
          'maxResolution'=>'17',
          'layers'=>'country',
          'copyrights' => array(
            array('minZoom'=>'1',
                  'bounds'=>'-190,-90,180,90',
                  'text'=>'© berkeley.edu',
            )
          ),
          'overlaywith'=>'Map',
          'merczoomlevel'=>'5',
         )
    );
    
    $mymap=array('id' => 'map',
                 'control' => 'Large',
                 'tcontrol' => 'on',
                 'center' => '37.8,-122.4819',
                 'width' => '100%',
                 'height' => '400px',
                 'type' => 'Map',
                 'markers' => $mymarkers,
    //             'feeds' => $myfeeds,
                 'wmss' => $mywmss,
                 );
    
    echo gmap_draw_map($mymap);
    

    External References

  • Geoserver & Google Maps
  • John Deck's Script- Call generic wms service for GoogleMaps v2
  • Comments

    webgeer’s picture

    Looks cool.

    I will try and get to testing this and committing it soon (2-3 days).

    I notice that you directly load the js from docs.codehause.com if it isn't local. Just want to make sure you have permission to do that.

    As for your issue about making direct call to map.getZoom(), I have been thinking that a way of addressing this is to have it so that no map uses that id and then before you call any of these function you would assign map={$gmap['mapid']} and then on return assign it back. A messy hack, but the best solution I have come up with.

    I haven't had time to try it out yet, but if you do and it works, I would like to hear about it.

    yecarrillo’s picture

    Chris Holmes from GeoServer project has moved his script to this new location.

    http://dist.codehaus.org/geoserver/gmaps-geoserver_scripts/wms-gs-1_0_0.js

    Now we have permission to link it directly from gmap module.

    yecarrillo’s picture

    StatusFileSize
    new9.17 KB

    I rewrote the patch with minor changes for gmap.module,v 1.30 .

    This tutorial is available too:

    http://docs.codehaus.org/display/GEOSDOC/Drupal

    Tobias Maier’s picture

    Status: Reviewed & tested by the community » Needs review
    yecarrillo’s picture

    StatusFileSize
    new9.72 KB

    This patch is an updated version with Macro filter added. For the example above, this is the macro:

    [gmap |id=map |center=-122.4819,37.8 |width=100% |height=400px |control=Large |type=Map |markers=blue::-123.1790542602539,49.19236205396474:Terminal bus stop |markers=green::-123.1538200378418,49.19224986943509:Service buildings bus stop + -123.14231872558594,49.191801128772326:Transer to Vancouver bus |wmss=WMS ::http://chignik.berkeley.edu/cgi-bin/mapserv440?map=/usr/local/web/html/google/wms.map& ::image/gif ::country ::1 ::17 ::1:-190,-90,180,90:© berkeley.edu ::Map::5]

    webgeer’s picture

    I have uploaded this to cvs. I should say that it wouldn't work for me.

    I used your macro on the page: http://www.webgeer.com/node/26 all you can see is the gray map. On the version using the php code the at http://www.webgeer.com/node/27 the wms layer seems to be underneath the googlemap. When you move/zoom the googlemap you sometimes briefly see the lines that I believe is the wms layer.

    I manually applied the patch and therefore it is possible that I missed something, or messed something up.

    Perhaps you coule look at the cvs version and see if it works for you as expected. Also you could look at the above page and see if the source seems right.

    I should mention that I'm not sure if I like the macro format you have created. I will think about it and see if I can come up with something a little cleaner.

    yecarrillo’s picture

    The spaces.

    I added spaces to the macro to make it more readable. However I didn't test it before make the patch. I think adding some "trim" will solve the problem.

    yecarrillo’s picture

    PHP

    WMS layer is behind of Google Map layer.

    In gmap.module please change:
    var l_'.$map_name.'=l_'.$map_name.'2.concat(l_'.$map_name.'1);
    with this
    var l_'.$map_name.'=l_'.$map_name.'1.concat(l_'.$map_name.'2);

    Macro:

    The center is wrong. In the macro please change
    center=-122.4819,37.8
    with
    center=37.8,-122.4819

    Spaces no allowed in the WMS services definition (some hint?)

    [gmap|id=map|center=-122.4819,37.8|width=100%|height=400px|control=Large|type=Map|markers=blue::-123.1790542602539,49.19236205396474:Terminal bus stop|markers=green::-123.1538200378418,49.19224986943509:Service buildings bus stop + -123.14231872558594,49.191801128772326:Transer to Vancouver bus |wmss=WMS::http://chignik.berkeley.edu/cgi-bin/mapserv440?map=/usr/local/web/html/google/wms.map&::image/gif::country::1::17::1:-190,-90,180,90:© berkeley.edu::Map::5]
    

    About the format... yeah, I hear suggestions.

    yecarrillo’s picture

    StatusFileSize
    new1.46 KB

    This patch is to correct the overlay z-order bug. If a user prefers overlay her/his WMS layer with hybrid Gmap, the the layers order is reversed.

    webgeer’s picture

    Status: Needs review » Fixed

    Thank you. That makes wms work as I expected. It is really cool. I think when I have some time, I will have to make up some demos of these features.

    PS. Please do future bug fixes/patches under a new issue

    Anonymous’s picture

    Status: Fixed » Closed (fixed)
    gisaalter’s picture

    Version: » 4.7.x-1.x-dev

    Maybe this isn't quite appropriate but can someone explain me how to apply these patches and where.
    I'm trying to integrate Geoserver with Drupal. I'm not that familiair with 'patches' in Drupal, yet I run in somethings I see here posted. Can someone give me some help ?

    yecarrillo’s picture

    hello gisalter.

    Most of this patches has been applied to the gmap module yet. All what you need is to download the latest 4.7.x version of gmap or eventually get the the gmap.module from the CVS tree:
    http://cvs.drupal.org/viewcvs/drupal/contributions/modules/gmap/

    Examples of use with geoserver were posted here:
    http://docs.codehaus.org/display/GEOSDOC/Drupal

    pazcu’s picture

    I think i have tried everything you post here but nothing gets the WMS features enabled... in addition i have not been able to get nodes to display in the map as bubbles. So I must be doing something wrong... any ideas?

    summit’s picture

    Version: 4.7.x-1.x-dev » 6.x-1.x-dev

    Will this WMS be part of gmap module? Subscribing, greetings, Martijn