Point-Mapping Extension: Unterschied zwischen den Versionen
HeinzJ (Diskussion | Beiträge) (→Munich) |
HeinzJ (Diskussion | Beiträge) (→Berlin) |
||
Zeile 87: | Zeile 87: | ||
==Berlin== | ==Berlin== | ||
− | + | ===using a bigger symbol=== | |
<pre> | <pre> | ||
<MapPoint> | <MapPoint> |
Version vom 23. August 2005, 16:39 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
Parameter
- $varURLMap: URL der Karte (z.B.: "http://www.giswiki.org/images/c/c1/DeutschlandRef.png";)
- $varURLPoint: URL des Punktsymbols (z.B.: "http://www.giswiki.org/images/1/1b/Reddot.gif";)
- $varMapWidth: = Breite der Karte im Ergebnis
- $PointExt: Punktsymbolgröße
- $A: Meters/Pixel in horizontaler x östlicher Richtung
- $E: Meters/Pixel in verticaler y nördlicher Richtung
- $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)
- $varPointLat: Punktkoordinate (Geographische Breite)
To Do's
- Übergabe mehrere Punkte
- Kombination mit einer Vorlage (??)
-
Parameterübergabe in mehreren Zeilen
Samples
Munich
<MapPoint> http://www.giswiki.org/images/b/b0/DeutschlandGeoref.png http://www.giswiki.org/images/1/1b/Reddot.gif 6 144 0.028662571242 -0.017977324880 5.499161111111 55.115925000000 11.5750 48.1400 </MapPoint>
<MapPoint> http://www.giswiki.org/images/b/b0/DeutschlandGeoref.png http://www.giswiki.org/images/1/1b/Reddot.gif 6 144 0.028662571242 -0.017977324880 5.499161111111 55.115925000000 11.5750 48.1400 </MapPoint>
using the bavarian flag
<MapPoint> 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 </MapPoint>
<MapPoint> http://www.giswiki.org/images/b/b0/DeutschlandGeoref.png http://upload.wikimedia.org/wikipedia/commons/a/a3/Flag_de-bayern_lozenge.png 20 144 0.028662571242 -0.017977324880 5.499161111111 55.115925000000 11.5750 48.1400 </MapPoint>
Berlin
using a bigger symbol
<MapPoint> 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 </MapPoint>
<MapPoint> 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 </MapPoint>
Code
<?php # MapPoint by Heinz-Josef Lücking h-j.luecking@t-online.de # # Copy this text into a file called "MapPoint.php" and save it into the directory "extensions" # To activate the extension, include it from your LocalSettings.php # with: include("extensions/MapPoint.php"); # # visit http://www.giswiki.org # # # Have fun # $wgExtensionFunctions[] = "wfMapPoint"; function wfMapPoint() { global $wgParser; $wgParser->setHook( "MapPoint", "renderMapPoint" ); } function renderMapPoint( $input ) { $varAr = explode("\n", $input); # Image(Map) and Point-files # e.g.: # $varURLMap = "http://www.giswiki.org/images/c/c1/DeutschlandRef.png"; # $varURLPoint = "http://www.giswiki.org/images/1/1b/Reddot.gif"; # $varMapWidth = 140; $varURLMap = $varAr[0]; $varURLPoint = $varAr[1]; $PointExt = $varAr[2]; # PointSize (width = height) # Getting some image-information $varMapWidth = $varAr[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: meters/pixel in horizontal x Easting direction # D: rotation about y axis, always 0 # B: rotation about x axis, always 0 # E: 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 # # Use a dot for commas! # # Sample for the image above # # $A = 0.028662571242; # $D = 0.000000000000; # $B = 0.000000000000; # $E = -0.017977324880; # $C = 5.499161111111; # $F = 55.115925000000; $A = $varAr[4]; $D = 0; $B = 0; $E = $varAr[5]; $C = $varAr[6]; $F = $varAr[7]; # The point which shall be displayed on the map # Coordinates must be Longitude and Latitude with decimal degrees # Use a dot for commas! # # e.g. Munich: # $varPointLon = 11.5750 # $varPointLat = 48.1400; $varPointLon = $varAr[8]; $varPointLat = $varAr[9]; # Calculating the position of the point on the image # $varPointX = ((11.5750 - 5.499161111111) / 0.028662571242) - 5; # $varPointY = ((48.1400 - 55.115925000000) / -0.017977324880) - 5; $xImg = ((($varPointLon - $C) / $A) * $varZoom) - ($PointExt / 2); $yImg = ((($varPointLat - $F) / $E) * $varZoom) - ($PointExt / 2); # Building the output $output = "<div id=\"myMap\" class=\"\" 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."\"> <div id=\"myMapPoint\" class=\"\" style=\"position: relative; left: 0px; top: 0px; width: ".$varMapWidth."px; height: ".$varMapHeigth."px; visibility: visible;\"> <img name=\"myMapPoint_\" style=\"opacity: 1.0; position: absolute; top: ".$yImg."px; left: ".$xImg."px;\" src=\"".$varURLPoint."\" height=\"".$PointExt."\" width=\"".$PointExt."\"> </div></div>"; return $output; } ?>