Point-Mapping Extension: Unterschied zwischen den Versionen
(→Parameter) |
(→To Do's) |
||
Zeile 39: | Zeile 39: | ||
=To Do's= | =To Do's= | ||
− | * Übergabe mehrere Punkte | + | * <strike>Übergabe mehrere Punkte</strike> |
* Kombination mit einer Vorlage (??) | * Kombination mit einer Vorlage (??) | ||
* <strike>Parameterübergabe in mehreren Zeilen</strike> | * <strike>Parameterübergabe in mehreren Zeilen</strike> | ||
* <strike>Punkte mit URL verbinden</strike> | * <strike>Punkte mit URL verbinden</strike> | ||
* Externes URLSymbol ([[Image:External.png]]) per CSS verschwinden lassen | * Externes URLSymbol ([[Image:External.png]]) per CSS verschwinden lassen | ||
− | * Alternativtext für Punkte | + | * ''Hinweistext und Alternativtext für Punkte'' |
=Samples= | =Samples= |
Version vom 24. August 2005, 16:02 Uhr
This Point-Mapping Extension (MapPoint) combines a referenced image / map and point-coordinates. The result is a geo-referenced map with a geo-referenced point.
Über eine Extension können Punktkoordinaten mit georeferenzierten Karten verbunden werden. Diese Möglichkeit wird mit der Point-Mapping_Extension gezeigt. Eine zuvor hochgeladene Deutschlandkarte, wie sie in vielen Artikeln zur Veranschaulichgung von Ortschaften genutzt wird, wird mittels einer MediaWiki-Extension georefernziert. Zusammen mit den ebenfalls an die Extension übergebenen Punktkoordinaten wird eine Karte generiert, in der die Lage des Punktes angezeigt wird.
Inhaltsverzeichnis
Features
- Darstellung eines Lagepunktes mittels geographischer Koordinaten
- Darstellung belibig vieler Punkte
- Verknüpfung des Punktes mit einem beliebigen Link
- Hinweisfenster beim Überfahren des Punktes mit der Maus
Installation
Parameter
- $varURLMap: URL der Karte/Image-URL (z.B.: "http://www.giswiki.org/images/c/c1/DeutschlandRef.png";)
- $varURLPoint: URL des Punktsymbols / Symbolimage-URL(z.B.: "http://www.giswiki.org/images/1/1b/Reddot.gif";)
- $varMapWidth: = gewünschte Kartenbreite / desired width of the map
- $PointExt: Punktsymbolgröße / desired symbol-size
- $A: Meters/Pixel in horizontaler x östlicher Richtung / meters/pixel in horizontal x Easting direction
- $E: Meters/Pixel in verticaler y nördlicher Richtung / meters/pixel in vertical y Northing direction
- $C: x Easting UTM coordinate of center of upper left pixel in meters
- $F: y Northing UTM coordinate of center of upper left pixel in meters
- $varPointLon: Punktkoordinate (Geographische Länge) / point coordinates - Longitude
- $varPointLat: Punktkoordinate (Geographische Breite) / point coordinates - Latitude
- $varHRef: Link (optional)
- $varTitle (=$varAlz): Für Hinweise (Mousover) und das <alt> tag (optional) / for hints and the <alt> tag
See Samples for input of parameters.
Links
To Do's
-
Übergabe mehrere Punkte - Kombination mit einer Vorlage (??)
-
Parameterübergabe in mehreren Zeilen -
Punkte mit URL verbinden - Externes URLSymbol () per CSS verschwinden lassen
- Hinweistext und Alternativtext für Punkte
Samples
Munich and Berlin
<MapPoints> [ http://www.giswiki.org/images/b/b0/DeutschlandGeoref.png http://www.giswiki.org/images/1/1b/Reddot.gif 6 140 0.028662571242 -0.017977324880 5.499161111111 55.115925000000 ] { 11.5750 48.1400 http://de.wikipedia.org/wiki/München München } { 13.394444 52.516667 http://de.wikipedia.org/wiki/Berlin Unsere allerliebste Hauptstadt } </MapPoints>
<MapPoints> [ http://www.giswiki.org/images/b/b0/DeutschlandGeoref.png http://www.giswiki.org/images/1/1b/Reddot.gif 6 140 0.028662571242 -0.017977324880 5.499161111111 55.115925000000 ] { 11.5750 48.1400 http://de.wikipedia.org/wiki/München München } { 13.394444 52.516667 http://de.wikipedia.org/wiki/Berlin Unsere allerliebste Hauptstadt } </MapPoints>
Munich - using the bavarian flag
<MapPoints> [ http://www.giswiki.org/images/b/b0/DeutschlandGeoref.png http://upload.wikimedia.org/wikipedia/commons/a/a3/Flag_de-bayern_lozenge.png 6 144 0.028662571242 -0.017977324880 5.499161111111 55.115925000000 ] { 11.5750 48.1400 http://de.wikipedia.org/wiki/München Dies ist die Hauptstadt von Bayern } </MapPoints>
<MapPoints> [ http://www.giswiki.org/images/b/b0/DeutschlandGeoref.png http://upload.wikimedia.org/wikipedia/commons/a/a3/Flag_de-bayern_lozenge.png 6 144 0.028662571242 -0.017977324880 5.499161111111 55.115925000000 ] { 11.5750 48.1400 http://de.wikipedia.org/wiki/München Dies ist die Hauptstadt von Bayern } </MapPoints>
Berlin - using a bigger symbol
<MapPoints> [ http://www.giswiki.org/images/b/b0/DeutschlandGeoref.png http://www.giswiki.org/images/1/1b/Reddot.gif 20 140 0.028662571242 -0.017977324880 5.499161111111 55.115925000000 ] { 13.394444 52.516667 http://de.wikipedia.org/wiki/Berlin Unsere allerliebste Hauptstadt } </MapPoints>
<MapPoints> [ http://www.giswiki.org/images/b/b0/DeutschlandGeoref.png http://www.giswiki.org/images/1/1b/Reddot.gif 20 140 0.028662571242 -0.017977324880 5.499161111111 55.115925000000 ] { 13.394444 52.516667 http://de.wikipedia.org/wiki/Berlin Unsere allerliebste Hauptstadt } </MapPoints>
Code
<?php # MapPoints by Heinz-Josef Lücking h-j.luecking@t-online.de # # Copy this text into a file called "MapPoints.php" and save it into the directory "extensions" # To activate the extension, include it from your LocalSettings.php # with: include("extensions/MapPoints.php"); # Hint: Do'nt mix up MapPoints with the older version MapPoint! # # visit http://www.giswiki.org # # Have fun # $wgExtensionFunctions[] = "wfMapPoints"; function wfMapPoints() { global $wgParser; $wgParser->setHook( "MapPoints", "renderMapPoints" ); } function renderMapPoints( $input ) { #----------------------------------------# # Splits input into basic map and points # #----------------------------------------# $s = $input; $s = str_replace("\n\r","|",$s); $s = str_replace("\n","|",$s); $s = str_replace("\r","|",$s); $s = str_replace("[|","[",$s); $s = str_replace("|]","]",$s); $s = str_replace("{|","{",$s); $s = str_replace("|}","}",$s); $s = str_replace("]|{","]{",$s); $s = str_replace("}|","}",$s); preg_match_all('/([\[\]{}])(.*?)([\[\]{}])/', $s, $matches, PREG_SET_ORDER); # explode foreach($matches as $match) { $varAr[] = explode('|', $match[2]); } #------ # MAP # #------ # Image(Map) and Point-file $varURLMap = $varAr[0][0]; $varURLPoint = $varAr[0][1]; $PointExt = $varAr[0][2]; # PointSize (width = height) # Getting some image-information $varMapWidth = $varAr[0][3]; # the width the image should be displayed $size = getimagesize("$varURLMap");# the real size of the image $height = $size[1]; # real height $width = $size[0]; # real width $varZoom = $varMapWidth / $width; # zoom-factor $varMapHeigth = $height * $varZoom; # computed image-heigth # Georeferencing the image (see http://en.wikipedia.org/wiki/World_file) $A = $varAr[0][4]; $E = $varAr[0][5]; $C = $varAr[0][6]; $F = $varAr[0][7]; #--------- # POINTS # #--------- foreach($varAr as $k=>$v) { if($k>0) { $varPointLon = $v[0]; $varPointLat = $v[1]; # Calculating the position of the point on the image $xImg = ((($varPointLon - $C) / $A) * $varZoom) - ($PointExt / 2); $yImg = ((($varPointLat - $F) / $E) * $varZoom) - ($PointExt / 2); # Adding an additional Link to the point; if ($v[2] == "") {$varHRef = "";} else {$varHRef = " href=\"".$v[2]."\""; } # for Hints (Mousover) and the <alt> tag if ($v[3] == "") {$varTitle = ""; $varAlt = "";} else {$varTitle = " title=\"".$v[3]."\""; $varAlt = " alt=\"".$v[3]."\""; } # add some random text to <div id="myMapPoints... $MapRand = rand(); $aPoint .= "<div id=\"myMapPoints".$MapRand."\" class=\"\" style=\"position: relative; left: 0px; top: 0px; width: 0px; height: 0px; visibility: visible;\"> <a ".$varHRef." ".$varTitle."><img name=\"myMapPoints_\" style=\"opacity: 1.0; position: absolute; top: ".$yImg."px; left: ".$xImg."px;\" src=\"".$varURLPoint."\" height=\"".$PointExt."\" width=\"".$PointExt."\" ".$varAlt." ></a></div>"; } } #---------------------# # Building the output # #---------------------# $MapRand = rand(); # add some random text to <div id="MapPoints... $output = "<div id=\"MapPoints".$MapRand."\" class=\"MapPoints\" style=\"position: relative; left: 0px; top: 0px; width: ".$varMapWidth."px; height: ".$varMapHeigth."px; visibility: visible; background-color: white;\"> <img name=\"myMap\" style=\"position: absolute; top: 0pt; left: 0pt;\" src=\"".$varURLMap."\" height=\"".$varMapHeigth."\" width=\"".$varMapWidth."\"> ".$aPoint."</div>"; return $output; } ?> pre> =Siehe auch= * [[:Kategorie:MediaWiki|Kategorie MediaWiki]] [[Kategorie:Web Mapping]] [[Kategorie:MediaWiki]]