QuickWMS-Extension

GISWiki - Das freie Portal für Geoinformatik (GIS)
Version vom 22. September 2006, 08:22 Uhr von HeinzJ (Diskussion | Beiträge)

(Unterschied) ← Nächstältere Version | Aktuelle Version ansehen (Unterschied) | Nächstjüngere Version → (Unterschied)
Wechseln zu: Navigation, Suche

Beschreibung / Description

The QuickkWMS-Extension for MediaWiki is using QuickWMS. It uses a WMS-Server for displying maps.


Scripte / Scripts

Stylesheet

Version / Changes

Until / Bis 17 August 2005

  • a first hack with bugs,
  • bild of a first MediaWiki-Extension,
  • some changes to the originaly files (pathes, etc).
  • works more or less with firefox

Until / Bis 19 August 2005

  • changing main div-layer to "position:relative"

To Do

  • Parameterübergabe / params
    • url, layer, version
  • Layout, Styles, Div-layers etc ..
  • Allowing multiple Maps on one page

Download

Some files of the originaly libary have been changed. A download will soon be available.

Beispiel / Sample

DEMIS Examples

Bathymetry

<QuickWMS>http://www2.demis.nl/wms/wms.asp?wms=WorldMap|Bathymetry|1.0.0</QuickWMS> <QuickWMS>http://www2.demis.nl/wms/wms.asp?wms=WorldMap%7CBathymetry%7C1.0.0%7C</QuickWMS>

Countries

<QuickWMS>http://www2.demis.nl/wms/wms.asp?wms=WorldMap|Countries|1.0.0</QuickWMS> <QuickWMS>http://www2.demis.nl/wms/wms.asp?wms=WorldMap%7CCountries%7C1.0.0%7C</QuickWMS>

Topography,Hillshading

<QuickWMS>http://www2.demis.nl/wms/wms.asp?wms=WorldMap|Topography,Hillshading|1.0.0</QuickWMS> <QuickWMS>http://www2.demis.nl/wms/wms.asp?wms=WorldMap%7CTopography,Hillshading%7C1.0.0%7C</QuickWMS>

Touristic Region of Eastern 'Upper' Back-Country of Zurich (TRZO)

<QuickWMS>http://webgis.hsr.ch/cgi-bin/trzo|zo_plan,gewaesser_pol,gewaesser,strassen,bahnen,orte,symbole_text|1.0.0|</QuickWMS>

<QuickWMS>http://webgis.hsr.ch/cgi-bin/trzo%7Czo_plan,gewaesser_pol,gewaesser,strassen,bahnen,orte,symbole_text%7C1.0.0%7C</QuickWMS>

Please Zoom-in some times. There seems to exist a problem of initial bounding box and/or scale especially for regional maps? Look at the TRZO homepage for another WMS client view.

Code


<?php

# QuickWMS WikiMedia extension
#
# Uses a WMS-Server for displying maps
#
# Copy this text into a file called "quickwms.php"
# To activate the extension, include it from your LocalSettings.php
# with: include("extensions/quickwms/quickwms.php");
#
# Replace http://www.giswiki.org by your wiki path
#
# Variables
#
# $varURL      server expressed in url;
# $varLayer    layer name ;
# $varVersion  specific version of the OGC WMS specification used;
# $varCaption  Caption;
#
#
# Use the tags <QuickWMS>varURL|varLayer|varVersion|<varCaptionQuickWMS> to display this map.
#
# Sample: "<QuickWMS>http://mapserv2.esrin.esa.it/cubestor/cubeserv/cubeserv.cgi|WORLD_MODIS_1KM:MapAdmin|1.0.0|Modis Mosaic</QuickWMS>"
#
# Missing: error-handling, ....


$wgExtensionFunctions[] = "wfQuickWMSExtension";

function wfQuickWMSExtension()
{
  global $wgParser;
  $wgParser->setHook( "QuickWMS", "renderQuickWMS" );
}

# The callback function for converting the input text to HTML output
function renderQuickWMS( $input )
{

$varAr = explode("|", $input);

$varURL      =  $varAr[0];
$varLayer    =  $varAr[1];
$varVersion  =  $varAr[2];
$varCaption  =  $varAr[3];

$MapVar = rand();

$aQuickWMS ="
<link rel=\"stylesheet\" href=\"/extensions/quickwms/inc/quickWMS.css\">
<script language=\"Javascript\" src=\"http://www.giswiki.org/extensions/quickwms/inc/WMSbrowsers.js\"></script>
<script language=\"Javascript\" src=\"http://www.giswiki.org/extensions/quickwms/inc/WMSlayer.js\"></script>
<script language=\"Javascript\" src=\"http://www.giswiki.org/extensions/quickwms/inc/WMSmap.js\"></script>
<script language=\"Javascript\" src=\"http://www.giswiki.org/extensions/quickwms/inc/WMStools.js\"></script>
<script language=\"Javascript\" src=\"http://www.giswiki.org/extensions/quickwms/inc/WMSquick.js\"></script>
<script language='Javascript'>
  function writeMaps(){
    var map = new quickWMS(-180, -90, 180, 90);
    map.addLayer(\"".$varURL."\", \"".$varLayer."\", \"".$varVersion."\", \"".$varCaption."\");
    map.onError = function (layer){alert(\"error\")}
    map.layers[0].format=\"JPEG\";
    map.writeDOM(\"myMap".$MapVar."\", 0, 0, 350, 175, \"background-color:white;border-style:solid;border-width:1;border-color:black;\");
    map.toolbar = new toolBar(map);
    map.toolbar.writeDOM(0,0,true);
    map.refresh();
    }
writeMaps();
</script>
";

return $aQuickWMS;
}
?>

Siehe auch