Project

General

Profile

Configuration

The viewer has two configuration files:
  • adagucviewer/config.php
  • adagucviewer/config.js

Config.php

In config.php the trusted hosts can be configured and a proxy can be set.

Configuration of trustedURLS is only required when other than GetCapabilities and GetMap request are required. By default, JavaScript is not allowed to access websites outside its own domain. To solve this, a call is routed through the server which is able to make a request to another domain. For safety, the site needs to be added to to trustedURLS array before the viewer can communicate with these websites.

The proxy is useful when the URL of a service is different between the machine where the viewer is installed and where the viewer is being used. For example when the external name of a service is https://data.knmi.nl/wms/cgi-bin/wms.cgi?, and the internal name is http://localhost/cgi-bin/wms.cgi?, a proxy can be configured:

function replaceHostName($url){
  $url = str_replace("https://data.knmi.nl/wms/cgi-bin/","http://localhost/cgi-bin/", $url);
  return $url;
}

This way the request can stay on localhost and does not need to go outside to https://data.knmi.nl/ and go back inside again.

<?php
  $trustedURLS=array(
    "http://geoservices.knmi.nl",
    "http://msgcpp.knmi.nl",
    "https://data.knmi.nl" 
  );

  function replaceHostName($url){
    //$url = str_replace("externalhostname","internalhostname", $url);
    return $url;
  }

/*--- Now new line at the end of this file allowed --- */?>

I18n configuration

Default, there are two languages in the ADAGUC viewer: English and Dutch.
To select which one to use, change the value of defaultLanguage in config.js (respectively 'en' and 'nl').

To add a language, copy paste the 'lang.nl.js' file from the 'I18n' folder.
Rename it like 'lang.<language>.js'.
Replace <language> with an abbreviation of the chosen language, like 'gb' for Great Britain.

Once renamed, translate all the phrases.
Once done, adjust the defaultLanguage value in config.js with the value of <language> above.

Config.js

In config.js the baselayer configuration, the datachooser and the maptype chooser can be configured:

var baseLayerConfiguration = [
  {
    service:"http://geoservices.knmi.nl/cgi-bin/bgmaps.cgi?",
    name:"naturalearth2",
    title:"World base layer",
    enabled: true,
    format:"image/gif" 
  },{
    service:"http://geoservices.knmi.nl/cgi-bin/worldmaps.cgi?",
    name:"world_line",
    format:"image/png",
    title:"World country borders",
    enabled: true,
    keepOnTop:true
  }
];

var defaultLanguage = { language: 'nl' }; <-- Language for the ADAGUC viewer.

var defaultUsernameSearch = "adaguc"; <-- Username for the GeoNames API. 

var geoNamesURL = "http://api.geonames.org/search?q={searchTerm}&username={username}&maxRows=1"; <-- URL for the GeoNames API. Requires 'defaultUsernameSearch' to be a valid username.

var knmiGeoNamesURL = "http://server.nl/webservice/knmi_geonames.cgi?q={searchTerm}"; <-- URL to the CGI script for connecting to the SQLite DB.

/* URL for creating/updating/deleting flags */
var knmiFlagURL = "http://server.nl/cg-bin/knmi_point_interest.cgi?"; <-- URL for creating / deleting / updating flags inside a NetCDF file ( pointInterestFileName )

/* URL for getting the information about the points of interest NetCDF file. */
/* pointInterestFileName is the name for the source file. */
var knmiGetPointsOfInterestURL = "http://server.nl/cg-bin/poi.cgi?"; <-- URL for getting Points of Interest via CGI script.
var pointInterestFileName = "name"; <-- Filename of NetCDF file containing flags, without the .nc extension ( dir is hardcoded in knmiGetPointsOfInterestURL script ).

var dataChooserConfiguration = [
  {
    title:'Points of Interest',
    thumbnail:knmiGetPointsOfInterestURL + 'source%3D' + pointInterestFileName + '&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&LAYERS=baselayer,name&WIDTH=1585&HEIGHT=1014&CRS=EPSG%3A4326&STYLES=auto%2Fpoint&FORMAT=image/png&BBOX=-90,-180,90,180',
    service:knmiGetPointsOfInterestURL + 'source%3D' + pointInterestFileName + '&service=WMS&request=GetCapabilities',
    layer:'name'
  },{
    title:'KNMI realtime precipitation radar',
    thumbnail:'http://adaguc.knmi.nl/contents/webservices/RADNL_OPER_R___25PCPRR_L3.jpg',
    service:'http://geoservices.knmi.nl/cgi-bin/RADNL_OPER_R___25PCPRR_L3.cgi?',
    layer:'RADNL_OPER_R___25PCPRR_L3_COLOR',
    srs:'EPSG:3857',
    bbox:'220000,6500000,1000000,7200000'/*,
    baselayerservice:'http://geoservices.knmi.nl/cgi-bin/MODIS_Netherlands.cgi?',
    baselayername:'modis_250m_netherlands_8bit'*/
  },{
    title:'MSGCPP realtime',
    thumbnail:'http://msgcpp.knmi.nl/mediawiki/images/thumb/d/d9/MSG-CPP_Screenshot-Google_Earth-cwp.png/750px-MSG-CPP_Screenshot-Google_Earth-cwp.png',
    service:'http://msgcpp-ogc-realtime.knmi.nl/msgrt.cgi?',
    layer:'atmosphere_optical_thickness_due_to_cloud'
  },{
    title:'MSGCPP archive',
    thumbnail:'http://msgcpp.knmi.nl/mediawiki/images/thumb/d/d9/MSG-CPP_Screenshot-Google_Earth-cwp.png/750px-MSG-CPP_Screenshot-Google_Earth-cwp.png',
    service:'http://msgcpp-ogc-archive.knmi.nl/msgar.cgi?',
    layer:'atmosphere_optical_thickness_due_to_cloud'
  },{
    title:'OMI daily SO2',
    thumbnail:'http://adaguc.knmi.nl/contents/webservices/OMI_TDCSO2_L3.jpg',
    service:'http://geoservices.knmi.nl/cgi-bin/OMI___OPER_R___TDCSO2__L3.cgi?',
    layer:'OMI_L3_TDCSO2',
    srs:'EPSG:4326',
    bbox:'-180,-90,180,90'
  }
];

var mapTypeConfiguration = [ 
  { 
    title: 'World WGS84', 
    bbox: [-180,-90,180,90], 
    srs: 'EPSG:4326',
    baselayer:{service:'http://geoservices.knmi.nl/cgi-bin/bgmaps.cgi?',name:'naturalearth2'}
  },{ 
    title: 'World Mercator', 
    bbox: [-19000000,-19000000,19000000,19000000],
    srs: 'EPSG:3857',
    baselayer:{service:'http://geoservices.knmi.nl/cgi-bin/bgmaps.cgi?',name:'naturalearth2'}
  },{ 
    title: 'Europe+N.Atl.Oc. (32661)', 
    bbox: [-3E6,-4E6,4.5E6,0.5E6], 
    srs: 'EPSG:32661',
    baselayer:{service:'http://geoservices.knmi.nl/cgi-bin/bgmaps.cgi?',name:'naturalearth2'}
  },{ 
    title: 'Europe (32661)', 
    bbox: [-0.2E6,-4E6, 5.5E6,0.2E6], 
    srs: 'EPSG:32661',
    baselayer:{service:'http://geoservices.knmi.nl/cgi-bin/bgmaps.cgi?',name:'naturalearth2'}
  },{ 
    title: 'Western Europe (32661)', 
    bbox: [1200000,-3000000,3250000, -1000000],
    srs: 'EPSG:32661',
    baselayer:{service:'http://geoservices.knmi.nl/cgi-bin/bgmaps.cgi?',name:'naturalearth2'}
  },{ 
    title: 'The Netherlands (28992)', 
    bbox: [-350000,125000,700000,900000 ],
    srs: 'EPSG:28992',
    baselayer:{service:'http://geoservices.knmi.nl/cgi-bin/bgmaps.cgi?',name:'naturalearth2'}
  },{ 
    title: 'North Pole (3411)', 
    bbox: [-6000000,-6000000,6000000,6000000],
    srs: 'EPSG:3411',
    baselayer:{service:'http://geoservices.knmi.nl/cgi-bin/bgmaps.cgi?',name:'naturalearth2'}
  },{ 
    title: 'South Pole (3412)', 
    bbox: [-6000000,-6000000,6000000,6000000],
    srs: 'EPSG:3412',
    baselayer:{service:'http://geoservices.knmi.nl/cgi-bin/bgmaps.cgi?',name:'naturalearth2'}
  },{ 
    title: 'North Pole Europe (3575)', 
    bbox: [-13000000,-13000000,13000000,13000000],
    srs: 'EPSG:3575',
    baselayer:{service:'http://geoservices.knmi.nl/cgi-bin/bgmaps.cgi?',name:'naturalearth2'}
  },{ 
    title: 'Openstreetmap World', 
    bbox: [-19000000,-19000000,19000000,19000000],   
    srs: 'EPSG:3857', 
    baselayer:{service:'http://geoservices.knmi.nl/cgi-bin/bgmaps.cgi?',name:'streetmap'}
  },{ 
    title: 'Openstreetmap NL', 
    bbox: [220000,6500000,1000000,7200000],   
    srs: 'EPSG:3857', 
    baselayer:{service:'http://geoservices.knmi.nl/cgi-bin/bgmaps.cgi?',name:'streetmap'}
  },{ 
    title: 'Openstreetmap Schiphol', 
    bbox: [515813.2988839851,6850485.5537392385,544160.8241851525,6869318.449956324],   
    srs: 'EPSG:3857', 
    baselayer:{service:'http://geoservices.knmi.nl/cgi-bin/bgmaps.cgi?',name:'streetmap'}
  },{ 
    title: 'Modis image NL', 
    bbox: [-350000,125000,700000,900000],   
    srs: 'EPSG:28992', 
    baselayer:{service:'http://geoservices.knmi.nl/cgi-bin/MODIS_Netherlands.cgi?',name:'modis_250m_netherlands_8bit'}
  }
];