User talk:Mafs/GoogleMapExtension

From Meta, a Wikimedia project coordination wiki

Keep on getting a "Fatal error: Call to undefine..."[edit]

"Fatal error: Call to undefined..." in the left hand navigaton area appeared after I replaced the MonoBook.php function with the given code. I'm using MediaWiki 1.12. The gmap extensions in special:versions says it is (Version 09/21/2005). All the other changes have been done without any obvious problems. Unfortunately the same results: No map and no errors.

I have the correct API for my website. I have uploaded the code which you get after you get your key into the root and into the wiki's folder to check if the API is correct. I can see the map. I have changed the localsettings.php to your suggestion as well as copied the line from the Google code into localsettings.php without any change in the results. I have tried this on the different browsers: IE7 gives me an error on the page in the bottom status bar, Firefox 3 does nothing and Opera does nothing. Firefox 3 does show that it is getting data from maps.google.com but does not seem to be doing anything with it. You can view the wiki to double check the source code.

When adding a gmap code on your page, I got this error message
Fatal error: Call to undefined function wfstrencode() in /home/bloukous/public_html/wiki/extensions/gmap.php on line 311
I updated the gmap.php with my current code, especially the line for include/DatabaseFunctions.php is important
...
require_once( "includes/DatabaseFunctions.php" );

function gmapCreate($input) {

	$gmap = new Gmap();
	return $gmap->gmapCreateMap($input);
}

--Wikinaut 06:08, 5 August 2008 (UTC)[reply]

The page for the new code for gmap.php does not display correct. There are a few "pre" tags in your code which changes the format. I don't want to change anything, I might just screw it up completely :)

I saw it, too. It appears to be as only result of rendering the tags here on metawiki. Anyway, you simply ignore that rendering and need to "edit this page", mark all, copy to the new file gmap.php and remove the one leading <pre> and one trailing </pre> tag. I thought you know how to put the code into the file.

I initially did it like that, but it did not work so I assumed that I missed something. I redid it just now but still no maps. I do not get the error any more when creating a GmapXML link. Have created a test page i.s.o changing the front page the whole time.

IT SEEMS TO BE WORKING!!!! I have recreated all the files, this time by editing the pages en copying the code from the edit or source of the page without the pre tags, uploaded it, refreshed the cache, and saw my very first map on Mediawiki!!! I think it might have been the fact that I initially copied the code straight from the page and not from the code of the page? I really hope my stupidity didn't give you too much of a hard time.

Now this is probably me again, but I can't get a gpx file to display on the map. Would you mind confirming the format of the code I used. The file is accessible in an open directory. I can not get the type setting to work either. Regardless of what I set it to, it always displays a map. I can however change the type of map when I enable control. When rss=GpsXML/ and I click on the map, I also do not get the blue marker.

Works on 1.67?[edit]

I can't seem to get this extension working after I upgraded to 1.67. Does anyone have this working?


Creating Marker Pages with a Redirect[edit]

I'm using this extension, and i think its a wonderful addition. My question is;

If i create a new page using the link to "Create a new page for point Lat=XX,Long=XX" etc, and the page that i create contains a REDIRECT tag, then the point is not displayed in the map.

How can i change the code to enable this point to be displayed. I'd like to eventually create points on the map which link to other pages in my wiki. I'm quite happy to have a REDIRECT page in between, but this doesn't seem to work at the moment.

Cheers, GeeWhizz.

Answer Thanks for your observation. I included redirect support in gmap.php. Mafs 20:41, 16 October 2005 (UTC)[reply]

Problems 1.4.X[edit]

Hi,

A couple of little problems I encountered in setting up the extension:

  • I had to change line 335 of gmap.php to replace 'page' with 'cur' as the table name & field prefix
$sql = "UPDATE $wgDBprefix"."cur SET cur_touched='$now' WHERE cur_namespace=$ns AND cur_title='$ti'";
'cur' has to be used for version 1.4.x and 'page' for version 1.5.x. Mafs
function wfGetPageTextFromTitle($title) {
   $text = "";
   if (trim($title) == "") return $text;
   $t = Title::newfromText($title);
   if ($t->userCanRead()) {
       $article = new Article($t);
       $text = $article->getContent(true);
   }
   return $text;
}
  • I had to enclose the foreach loop at line 222 with if ( $feeds ) { . . . } to avoid an invalid parameter message - this may be PHP5 only and is also only true if there is no rss parameter set.

--GreyHead 16:23, 3 September 2005 (UTC)[reply]

Thanks for your observation, the script has been adapted. Mafs 21:23, 7 September 2005 (UTC)[reply]

GPX[edit]

A cool mod to your extension would be to allow it to plot GPX data. An example of what I'm thinking of is here:

http://www.tom-carden.co.uk/googlegpx/

I might give it a try once I have a chance to get more familiar with MediaWiki and the Google Maps API.

--Boone 21:44, 12 September 2005 (UTC)[reply]

Answer: Hi Boone, could you place the content of an example gpx file on User_talk:Mafs/GoogleMapExtension/GPX. It should not be too difficult to adapt the script accordingly. Mafs 07:07, 13 September 2005 (UTC)[reply]
I put some data on that page. Thanks for having a look. --Boone 13:22, 13 September 2005 (UTC)[reply]
I am working on it ... Mafs 19:55, 14 September 2005 (UTC) File:Gpx.png[reply]
Looks like you're making good progress. I came across a link you might be interested in:

http://cse-mjmcl.cse.bris.ac.uk/blog/2005/07/26/1122414882406.html --Boone 16:56, 16 September 2005 (UTC)[reply]

Interactive Markers[edit]

I don't understand how the interactive markers work, or it's not doing anything for me. I use the rss=GmapXML/ argument, but don't see any effect. How does it work?

update
got it working, did not have the latest version of the code; still fuzzy on how to use it


Hmmm I am having the same problem -- got the blue marker working, click on create, edit the new page which has the coordinates in the title but nothing ever appears on the map, even after a full refresh. Recent changes show that the pages are being created... this is under Firefox 2.0 and IE7 213.86.40.182

Does your gmap line looks like this one including the rss part?
 <gmap>lat=53|lon=12|width=600|height=500|zoom=12|controls=no|type=hybrid|rss=GmapXML/</gmap>
Did you create the cache directory correctly, see http://meta.wikimedia.org/wiki/User:Mafs/GoogleMapExtension#Cache ?
Mafs 12:17, 25 November 2006 (UTC)[reply]
I have
 <gmap> rss=GmapXML/ | width=700  | height=600 | zoom=3 | lat=51.54117057649492 | long=-0.17449378967285156 | type=street | </gmap>
there is a cache directory with a .gpx file inside it