Brion Vibber wrote:
- Should extensions be put in the extensions module or in the
phase3/extensions directory?
Extensions that go into our main CVS should go in the extensions module.
OK, I did that. One caveat is that I could not get an include into "../extensions/gis/geo.php" to work (some security concern?), so I wrote in the instructions that extensions/gis needs to be moved into phase3/extensions/gis before use. Seems like a hack; there is probably something I didn't understand.
I have now included support for the geo database, and included support for finding neighboring articles as well as support for generating points for Wikimaps. The database table is defined as follows:
CREATE TABLE wikipedia_gis ( gis_id int(8) unsigned NOT 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_region char(2) binary default '', gis_type char(12) binary default '', gis_type_arg char(12) binary default '',
KEY gis_id (gis_id), INDEX gis_latitude_min (gis_latitude_min), INDEX gis_latitude_max (gis_latitude_max), INDEX gis_longitude_min (gis_longitude_min), INDEX gis_longitude_max (gis_longitude_max) );
Comments invited, I am totally stupid wrt databases. I added the table manually, but I believe there must be a fancy way in the maintenance module to do this without shell access. If anyone can tell me how, that would be appreciated.
Database entry is implemented as ArticleSaveComplete and ArticleDelete hooks. The hook will first delete all entries belonging to the article ID, and then, based on Parser::extractTags( 'geo',...), add new entries as required.
I have used article ID instead of title as key, because I believe that is more efficient. The downside is that I have to look up the title from the ID upon retrieval. This is currently done locally by:
$name_dbkey = $this->db->selectField( 'page', 'page_title', array( 'page_id' => $id), $fname ); return str_replace( '_', ' ', $name_dbkey );
This creates an unnecessary version dependency, I believe. So any suggestions for a better approach are highly welcome.
I am running a test on a private server with a couple of thousand points which seem to work fine, but if it is possible with a more public test, that would be highly appreciated.
I will update the documentation, but here is a couple of sample requests. To get a list of all Wikipedia articles within a radius of 5 km from the White House in Washington:
http:/phase3/extensions/gis/index.php?near=38.8954_N_-77.0366_E&dist=5
My sample implementation gives a list of 7 locations for the above request. (For the time being, I'm embedding this link as the first in "Map sources". It should probably appear in the 'navigation' box instead/also)
For a Wikimap style list of all airports in the world:
http:/phase3/extensions/gis/index.php?maparea=90_N_180_E_to_90_S_180_W_type:airport
The Wikimap lists are of course meant to be used indirectly in Wikimaps, but I believe the format should also be suitable as a basis for export also, e.g. to World Wind.
en:User:Egil