|
|
Zeile 1: |
Zeile 1: |
| * [[Google Maps Extensions]] | | * [[Google Maps Extensions]] |
| | | |
− | =GIS-Extension=
| + | * [[MediaWiki GIS-Extension]] |
− | | + | |
− | Die GIS-Erweiterung auf der [http://meta.wikimedia.org/wiki/Gis MediaWiki-Seite] wurde erweitert.
| + | |
− | | + | |
− | Die Tabelle GIS wurde um zwei Felder erweitert. In folgender SQL-Anweisung sind die Änderungen fett hervorgehoben. Hinzu kam ein Feld '''gis_title''' für die Aufnahme alternativer/zusätzlicher Texte sowie das Feld '''gis_url''' um auf weitere Weblinks verweisen zu können als nur die aktuell verwendete Artikelseite.
| + | |
− | | + | |
− | ==Tabelle==
| + | |
− | | + | |
− | CREATE TABLE /*$wgDBprefix*/gis (
| + | |
− | gis_page int(8) unsigned NOT NULL,
| + | |
− | '''gis_title varchar(255) binary default NULL,'''
| + | |
− | '''gis_url varchar(255) binary default NULL,'''
| + | |
− | gis_latitude_min real NOT NULL,
| + | |
− | gis_latitude_max real NOT NULL,
| + | |
− | gis_longitude_min real NOT NULL,
| + | |
− | gis_longitude_max real NOT NULL,
| + | |
− | gis_globe char(8) binary NOT NULL default '',
| + | |
− | gis_type char(12) binary,
| + | |
− | gis_type_arg real NOT NULL default 0,
| + | |
− |
| + | |
− | KEY gis_page (gis_page),
| + | |
− | INDEX gis_globe (gis_globe),
| + | |
− | INDEX gis_type (gis_type),
| + | |
− | INDEX gis_type_arg (gis_type_arg)
| + | |
− | );
| + | |
− | | + | |
− | ==Dateien/Funktionen==
| + | |
− | | + | |
− | Folgende Dateien/Funktionen der GIS-Erweiterung wurden diesbezüglich angepasst.
| + | |
− | * database.php
| + | |
− | * geo.php
| + | |
− | | + | |
− | Hier die Änderungen in den Funktionen. Änderungen sind fett gekennzeichnet.
| + | |
− | | + | |
− | ===database.php - function article_save_geo===
| + | |
− | | + | |
− | function article_save_geo ( $article, $user, $text )
| + | |
− | {
| + | |
− | $id = $article->getID();
| + | |
− |
| + | |
− | $g = new gis_database();
| + | |
− |
| + | |
− | $g->delete_position( $id );
| + | |
− |
| + | |
− | $tag = 'geo';
| + | |
− | $gis_content = array();
| + | |
− | $text = Parser::extractTags( $tag, $text, $gis_content );
| + | |
− |
| + | |
− | foreach( $gis_content as $marker => $content ) {
| + | |
− |
| + | |
− | $p = new geo_param( $content );
| + | |
− | $attr = $p->get_attr();
| + | |
− |
| + | |
− | //Begin Changes
| + | |
− | //
| + | |
− | //Added code for support of field "gis_title" and "gis_url"
| + | |
− | //see also "database.php"
| + | |
− | //Heinz-Josef Lücking - 7.7.2005
| + | |
− | //
| + | |
− |
| + | |
− | $g->add_position( $id,
| + | |
− | $p->latdeg_min, $p->londeg_min,
| + | |
− | $p->latdeg_max, $p->londeg_max,
| + | |
− | $attr['globe'],
| + | |
− | $attr['type'], $attr['arg:type']''', $attr['title'], $attr['url']''' );
| + | |
− |
| + | |
− | //End Changes
| + | |
− | }
| + | |
− | return true;
| + | |
− | }
| + | |
− | | + | |
− | ===database.php - function add_position===
| + | |
− | | + | |
− | function add_position( $id, $latmin, $lonmin,
| + | |
− | $latmax, $lonmax, $globe, $type, $type_arg, $title, $url)
| + | |
− | {
| + | |
− |
| + | |
− | $fname = 'gis_database::add_position';
| + | |
− |
| + | |
− | //Begin Changes
| + | |
− | //
| + | |
− | //Added code for support of field "gis_title" and "gis_url"
| + | |
− | //see also "database.php"
| + | |
− | //Heinz-Josef Lücking - 7.7.2005
| + | |
− | //
| + | |
− |
| + | |
− | '''//If no title is set, the pagename is used.'''
| + | |
− |
| + | |
− | '''if ($title == "") '''
| + | |
− | '''{'''
| + | |
− | ''' $aTitle = gis_database::get_title( $id );'''
| + | |
− | '''} else {'''
| + | |
− | ''' $aTitle = $title;'''
| + | |
− | '''};'''
| + | |
− | | + | |
− | if (!$globe) $globe = "";
| + | |
− |
| + | |
− | $type_arg = str_replace( ',', '', $type_arg); /* ignore commas */
| + | |
− |
| + | |
− | $this->db->insert( 'gis',
| + | |
− | array(
| + | |
− | 'gis_page' => $id,
| + | |
− | ''''gis_title' => $aTitle,'''
| + | |
− | ''''gis_url' => $url,'''
| + | |
− | 'gis_latitude_min' => $latmin,
| + | |
− | 'gis_longitude_min' => $lonmin,
| + | |
− | 'gis_latitude_max' => $latmax,
| + | |
− | 'gis_longitude_max' => $lonmax,
| + | |
− | 'gis_globe' => $globe,
| + | |
− | 'gis_type' => $type,
| + | |
− | 'gis_type_arg' => $type_arg),
| + | |
− | $fname );
| + | |
− |
| + | |
− | //End Changes
| + | |
− | }
| + | |
− | | + | |
− | ===geo.php - function geo_param===
| + | |
− | | + | |
− | function geo_param( $param )
| + | |
− | {
| + | |
− |
| + | |
− | //Begin Changes
| + | |
− | //
| + | |
− | //Added code for support of field "gis_title" and "gis_url"
| + | |
− | //see also "database.php"
| + | |
− | //Heinz-Josef Lücking - 7.7.2005
| + | |
− | //
| + | |
− | '''$sparam = str_replace( ' title:', '#|title:', $param);'''
| + | |
− | '''$sparam = str_replace( ' url:', '#|url:', $sparam);'''
| + | |
− |
| + | |
− | '''$arparam = explode("#", $sparam );'''
| + | |
− |
| + | |
− | '''for ($i=0; $i<count($arparam); $i++) {'''
| + | |
− | '''$var = stristr($arparam[$i],'|');'''
| + | |
− | '''if ($var === false) {'''
| + | |
− | '''$var = str_replace( '_', ' ', $arparam[$i] );'''
| + | |
− | '''$var = str_replace( ' ', '|', $var );'''
| + | |
− | '''$arparam[$i] = $var;'''
| + | |
− | '''}'''
| + | |
− | '''}'''
| + | |
− | '''$sparam =implode("",$arparam);'''
| + | |
− |
| + | |
− | '''$this->pieces = explode("|", str_replace( '_', ' ', $sparam ));'''
| + | |
− |
| + | |
− | //End Changes
| + | |
− |
| + | |
− | $this->get_coor( );
| + | |
− |
| + | |
− | $this->latdeg_min = $this->latdeg_max = $this->latdeg;
| + | |
− | $this->londeg_min = $this->londeg_max = $this->londeg;
| + | |
− | if ($this->pieces[0] == "to") {
| + | |
− | array_shift($this->pieces);
| + | |
− | $this->get_coor();
| + | |
− | if ($this->latdeg < $this->latdeg_max) {
| + | |
− | $this->latdeg_min = $this->latdeg;
| + | |
− | } else {
| + | |
− | $this->latdeg_max = $this->latdeg;
| + | |
− | }
| + | |
− | if ($this->londeg < $this->londeg_max) {
| + | |
− | $this->londeg_min = $this->londeg;
| + | |
− | } else {
| + | |
− | $this->londeg_max = $this->londeg;
| + | |
− | }
| + | |
− | $this->latdeg = ($this->latdeg_max+$this->latdeg_min) / 2;
| + | |
− | $this->londeg = ($this->londeg_max+$this->londeg_min) / 2;
| + | |
− | $this->coor = array();
| + | |
− | }
| + | |
− | }
| + | |
| | | |
| =Koordinatentool "hjl_get_Coor"= | | =Koordinatentool "hjl_get_Coor"= |
wurde ein Tool für das GISWiki und MediaWiki entwickelt, das die Erstellung von Koordinatenbezügen erleichtert. Die Geokoordinaten werden den Google Maps entnommen. Eingabe- und Auswahlfelder bieten die Möglichkeit weitere Informationen hinzuzufügen.