Extension talk:Maps/LQT Archive 1

Archive

To keep the length of this page reasonable, pre-0.5 topics have been put here. If you have an issue with an older version, or want to continue a moved discussion, please do it on this page - the archive will not be checked.

See also


 * Semantic Maps discussion page for discussions related to the functionality Semantic Maps adds to Maps.

Links no longer allowed for display_point(s) marker labels in Maps 0.5
In version 0.4.2 of Maps, I was able to use wiki links (for example: Extension:Maps ) in the marker labels for #display_point(s). As of version 0.5, I don't think doing so is working anymore, and I just confirmed this on the demo wiki (see here). I see that the issue regarding links has come up before, so perhaps there isn't an easy fix. Just noting this here since I don't see anything about it in the documentation.--MiamiVolts 06:28, 24 December 2009 (UTC)

Hey,

This is a bug - the functionality should have been working.

The issue is that the html doesn't get escaped correctly, and this JS string is outputted.

"Rome"

This is easy to fix though. I'll make the commit tomorrow.

Cheers

-- Jeroen De Dauw 23:22, 28 December 2009 (UTC)

Proposal for retrieving address string entered by user when input type=googlemaps
Discussion moved to here.

Maps Extension Not Working
Hello:

I've been trying to get the maps extension working on my wiki. I'm using MediaWiki 1.15.1 and Maps 0.5.1. I have a Google Maps key, which I added to Local Settings.php, after the include statement for the extension. I've also explicitly set the default mapping service to Google Maps.

When I add the code:

to a page, instead of a map displaying, I see a list of checkboxes with the following options:

Photos Videos Wikipedia Webcams

Does anyone have any idea what's happening here?

Thanks,

Patricia (patricia (at) prwatch.org)

Hey,

I've put your wiki code on my wiki, and as you can see here, it's working without any problems. It sounds like your map is not showing up cause it has some wrong inclusion path. Check your page source. There should be some html including GoogleMapFunctions.js. I suspect that if you go to this path, you'll get an error saying it doesn't exist. If so, you probably have your $wgScriptPath variable wrongly configured.

Some not on your wiki code though:

Display_address has been deprecated for a while now, although apparently I didn't remove it from the code yet (which I should have done actually). Use display_point(s) instead.

You can even omit the address= part, like this:

Cheers!

-- Jeroen De Dauw 21:49, 30 December 2009 (UTC)

Hi Jeroen:

I've checked the page source and found the following line: 

The $wgScriptPath for our wiki is not set to the default path so that's why the script is not being found. We do not have an actual or virtual subdirectory called "wiki'. Is there a way to fix this?

Hey,

"The $wgScriptPath for our wiki is not set to the default path"

By that I'm assuming you have set it to something other then the default. Or do you mean you did not set it at all?

Either way, you simply need to assign the correct value to $wgScriptPath, which reflects the directory structured you are using.

Cheers

-- Jeroen De Dauw 01:14, 31 December 2009 (UTC)

Hi Jeroen:

I guess I didn't explain that very well.

On our wiki $wgScriptPath is set to "/swtest" and not "/wiki". So, I can't figure out why the path to GoogleMapFunctions.js is showing as "/wiki/extensions/Maps/GoogleMaps/GoogleMapFunctions.js" in the page source. In other words, I don't know where "/wiki" is coming from.

Just out of curiosity, I changed line 38 in Maps.php from: $egMapsScriptPath = $wgScriptPath. '/extensions/Maps'; to: $egMapsScriptPath = '/swtest/extensions/Maps'; and now the page source is showing as "/swtest/extensions/Maps/GoogleMaps/GoogleMapFunctions.js" and the maps are displaying.

So, I don't know why the correct value is not being passed from Maps.php unless the path is hard-coded.

Thanks again for your help and the great maps extension!

Patricia

Hey,

You need to set $wgScriptPath in LocalSettings before you include Maps. I guess you have it after the inclusion :)

Cheers

-- Jeroen De Dauw 14:42, 31 December 2009 (UTC)

Hi Jeroen:

That fixed the problem. I had indeed put the "require_once" line for the Maps extension before $wgScriptPath. Once I moved the line after $wgScriptPath, everything worked like a charm.

Thanks again for all of your help.

I hope you have a happy and prosperous New Year!

~Patricia

Javascript loading race condition breaks Maps 0.5.1 in Firefox 3.5.x when using Google Maps
I have run in to a problem using Maps 0.5.1 wherein using Google Maps and doing something simple like causes the resulting html page to hang in Firefox 3.5.x on both linux and windows. The page works correctly in Konqueror and Epiphany on linux, and works correctly in IE on windows. These are vanilla installs of Firefox in all cases, with no extra addins installed. I have only tried using Google Maps, and have not determined if this issue affects any of the other supported mapping services.

The details are below. After digging in to what is happening I believe that Maps is suffering from a known race condition in Firefox between loading javascript from the server and rendering html in the browser. References to this race condition problem are given below, as well as a link to a solution that essentially implements "lazy loading" of the javascript using ajax instead of loading the javascript by just hitting a URL in a section.

I have a template that is used to format some simple results on an SMW page. At one point the template has the following function call in one row/column of a wikitable:  When the resulting page is sent to browser it hangs, and the message "Read maps.gstatic.com" is in the status bar. This hang is 100% reproducible, and it never times out. The same page works in other browsers as described above, and it works in Firefox if I remove the #display_point call.

In the Firefox error console, I noted the following error when the page hangs: Error: _mF is not defined Source File: http://maps.gstatic.com/intl/en_us/mapfiles/193c/maps2.api/main.js Line: 3

In looking for information regarding this error I found the following thread: http://groups.google.com/group/google-maps-api/msg/5104d9bb8658e1bd. This discussion concerns a known race condition in loading javascript and loading html in Firefox. In reviewing the html the browser is attempting to render and the point at which the hang occurs, I believe it is this issue that breaks Maps in Firefox 3.5.x.

In the same thread a solution was implemented and shown to work as described here: http://www.google.com/url?sa=D&q=http://groups.google.com/group/Google-Maps-API/browse_thread/thread/8863f57e0904a221/3f1577e7abed928b&usg=AFQjCNEnlTAA1jhHBOk1JYJMgLjz9h2NTg.

I propose that the referenced solution be implemented in Maps for the Google Maps service, using ajax to load the Google Maps API javascript after the html is all loaded into the browser. At least for me, this is now a showstopper bug preventing use of Maps/SM (actually using MW at all, because I need SMW and Maps/SM for what I'm doing in my application).

I will start digging into the Maps code myself to see if I can implement the referenced "lazy loading" approach using ajax. However, if someone who is already familiar with the Maps code could make a pass at it that would be highly appreciated, and would certainly fix the problem much more quickly than waiting for me to ramp up on the Maps code sufficiently to make these changes myself. Also, my guess is that it might be better to implement this solution in a general manner that applies to all mapping services, whereas I will likely start out by just doing it for Google Maps to confirm that it resolves the hang symptom.

Thanks!

-Al

HTML / Wiki Links in Display Marker?
Hello Jeroen:

Just wondering if this has been fixed -- Extension_talk:Maps. I'm using MediaWiki 1.15.1 and Maps 0.5.1 and I haven't been able to get wiki or HTML links working in marker labels. It would be great to have this feature.

Thanks,

Patricia (patricia at prwatch.org)

Hey,

This has been fixed, but after 0.5.1 was released. The code will be part of 0.5.2, which does not have a fixed release date yet. You can get the latest code from SVN trunk though.

Cheers

-- Jeroen De Dauw 20:30, 7 January 2010 (UTC)

How to get multiple marker images in one map
Hi Jeroen,

This should be a very easy answer for you, but I can't seem to figure it out. I have a map with multiple locations. I want to add different colored markers to different points. Tried it here: http://www.snowboardwiki.nl/wiki_source/index.php?title=Locaties_in_Nederland Still, it doesn't seem to work. The thing I missed in this article: Where must I save the marker.png icons for the extension to work?

Thanks in advance. Len.

Hey,

See point specific data for more info about setting the marker icon.

Cheers

-- Jeroen De Dauw 01:24, 14 January 2010 (UTC)

Dear Jeroen, I've read that part of the article before I asked my question, but I couldn't find any information about where those icons are to be saved. Are they standard on the google maps server? Or do they have to be in a public_html map? Or do I have to upload them to mediawiki (already tried this, didn't work, but maybe I did something wrong). Hope you could help me with it. "and will display a pop-up with it's own title, it's own text, and will have it's own marker (an image with the name green-marker.png)."

Thanks! Len.

Hey,

The image file needs to be on your wiki server. I'm currently patching up the (really out of date) examples on my wiki, and will link you one demonstrating the marker icon usage as soon as I got one.

Cheers

-- Jeroen De Dauw 16:23, 16 January 2010 (UTC)

Thanks! Really looking forward to it. I'll add that info, as soon as I got it, to the text on this extension page. Len.

Hey,

Have a look at these examples to see how you can set markers. Also see the third one here on how to set the icon for all markers. You need to upload the icon via your wiki. If it's uploaded to File:Green_marker.png, you simply have to put Green_marker.png as value.

Cheers

-- Jeroen De Dauw 03:25, 19 January 2010 (UTC)

Turning markers on and off with check boxes
Hi Jeroen. Is it possible with the Maps extension to get this kind of output? http://www.geocodezip.com/v2_MarkerCheckBoxes.asp

It would be very helpful for my site, but I'm a bit of a noob on wiki-things, so maybe you can answer me on this one. Would be great. Thanks in advance, Len.

Hey,

Maps does not support such functionality. I can develop it though, if you are willing to fund it.

Cheers

-- Jeroen De Dauw 15:32, 12 January 2010 (UTC)

only Osm mapnik or mapnik by default ?
hi Jeroen

I have a question. on this page http://wikikit.homelinux.org/ccmgy/index.php/Carte_de_la_Ccmgy, i should like to obtain OSMmapnik layer by default instead of OSMarender. On this wiki i use the Maps 0.4.2. is it any issue ?

Thanks for your help Jeffdelonge 11:15, 12 January 2010 (UTC)

Hey,

The first layer will always be loaded as default. Simply specify the OSM layers separately, so you can choose the order. See how to define layers for more info.

A simple example: layers=osm-mapnik, osmarender

Also, I encourage you to upgrade to the latest version :)

Cheers

-- Jeroen De Dauw 15:37, 12 January 2010 (UTC)


 * thanks for your help but i had already tested this and it dosnt work and i dont know why. I also just wait for your next release  because of the pb about wikitext in popup
 * thank a lot --Jeffdelonge 22:33, 13 January 2010 (UTC)

Maps /w OpenLayers to make custom Video Game maps?
I'm running a Wiki dedicated to a new video game, Star Trek Online, and am trying to get a map on the site using Maps, Semantic Maps and OpenLayers.

Is this possible using this extension? I don't see any way to load a custom map using the settings in the Usage Docs here. The Openlayers site however specifically states that it can be used for this type of project.

Thanks

Hey,

You can indeed do this with OpenLayers. Maps (and SM) do not have support for this though. It is however the most requested feature to be added, and is on the to-do list for the next big release. The biggest issue with such functionality is probably deciding what the wikitext should look like.

I'm not really putting any effort in the next big release though ATM (and so is no one else). If you however can fund development of images-as-layers functionality, let me know.

Cheers

-- Jeroen De Dauw 15:58, 16 January 2010 (UTC)

Install note for 0.5.3
When I just upgraded from 0.5.1 to 0.5.3, none of my Google maps were displaying. Then, I checked through the new files and discovered that the 'googlemaps' service had been changed to be called 'googlemaps2'. So, in my LocalSettings.php file, where I was setting $egMapsAvailableServices and $egMapsAvailableGeoServices, I had to switch to use 'googlemaps2' in the arrays to Google maps to display again. I didn't see anything about this in the install/readme notes, so posting a heads-up here.--MiamiVolts 04:07, 5 February 2010 (UTC)

Hey,

You should indeed change googlemaps to googlemaps2 in your LocalSettings file when you are setting $egMapsAvailableServices.

Cheers

-- Jeroen De Dauw 17:15, 17 February 2010 (UTC)

Javscript problem in IE 8
I'm having serious problems with the google map display. In Firefox, everything is fine, but in IE8 errors are displayed.

The problematic page is the main page: http://www.verwaltungskooperation.at/index.php?title=Plattform_Verwaltungskooperation in the current version, I replaced the googlemap with a yahoomap, because then only the exclamation mark in IE (left bottom corner) is shown, but the page loads. When I use googlemap, the site cannot be loaded at all or the left menu is missing.

Here is a testpage with the googlemap that is causing the problems http://www.verwaltungskooperation.at/index.php?title=Test strangely, at first load it only shows the error, but reloading the page results in a message, the IE can't load the page.

The error is: Message: Function expected row: 955 column: 3 Code: 0 URI: http://www.verwaltungskooperation.at/skins/common/wikibits.js?207

So it must be some sort of incompatiblity with Maps and the MediwWiki skins (if I change to another than monobook, the error remains because wikibits.js is for all skins.

If I remove the map display altogether, no errors are showed on the rest of the page. It only happens with maps that display mutliple points. A single point on a map is no problem: http://www.verwaltungskooperation.at/index.php?title=Test:GoogleMaps

- Bernhard

Hey,

I replied on the mailing list - the problem should be solved after you upgrade to a recent version of Maps/SM.

Cheers

-- Jeroen De Dauw 17:15, 17 February 2010 (UTC)

Javascript error with Google Maps (0.5.3)
Hey Jeroen,

I have uncovered a javascript bug with the implementation of Google Maps.

onloadFuncts[i] is not a function http://foo.org/w/skins/common/wikibits.js (Line 955)

This occurs whenever a Google Map is displayed. This is being caused by the call to

addOnloadHook( initializeGoogleMap(...) );

(For Google Maps, this affects files GoogleMaps/Maps_GoogleMapsDispMap.php and GoogleMaps/Maps_GoogleMapsDispPoint.php) This is not the correct way to call addOnloadHook, because it is expecting a function, and you are passing whatever initializeGoogleMap returns. Instead you should be calling it like so:

addOnloadHook(function {initializeGoogleMap(...);});

This will prevent this error.

Hey,

Thanks a lot for reporting this, I did not know the current usage was wrong :)

Cheers

-- Jeroen De Dauw 20:01, 26 February 2010 (UTC)