1

Re: Gateway maps

I've worked out how to add NBN Gateway maps to the distribution map 1 prebuilt form in case anyone is interested. Assuming that you have a Drupal page setup for the distribution map and are using the taxon parameter in the query string to specify a species using the NBN Taxon version key, then you need to add the following JS to your page:

mapSettingsHooks.push(function(opts) {
  var url = window.location.href;
  var match = url.match(/taxon=[0-9A-Z]+/)[0];
  var parts = match.split('=');
  var layer = new OpenLayers.Layer.WMS("NBN Gateway data", "http://gis.nbn.org.uk/arcgis/rest/services/grids/SingleSpeciesMap/"+parts[1]+"/WMSServer", 
      {LAYERS: "2", CRS:"EPSG:3857", VERSION:"1.3.0", FORMAT:"png", TRANSPARENT: true}, {isBaseLayer: false});
  // splice the layer to the start of the layers array, so it appears under other data
  opts.layers.splice(0, 0, layer);
});

The easiest way to do this is to create a JavaScript file called node.nid.js (where nid is replaced by the node ID of the Drupal page) and save this in sites\all\modules\iform\client_helpers\prebuilt_forms\js. More information on this method of extending forms with custom css, JavaScript etc can be found at http://code.google.com/p/indicia/wiki/D … mOverrides.

John van Breda
Biodiverse IT