Extension talk:Google Maps/Discussion from meta

From MediaWiki.org
Jump to: navigation, search

Note: This page was copied from meta:Talk:Google Maps Extension, and is retained for archive purposes only. Please add new discussion to Extension talk:Google Maps.

The following discussion has been transferred from Meta-Wiki.
Any user names refer to users of that site, who are not necessarily users of MediaWiki.org (even if they share the same username).

Having Problems with Preview Page after Extension Install[edit | edit source]

MediaWiki: 1.6.8 PHP: 4.4.4 MySQL: 4.1.21-standard-log

I've installed this extension and it works perfectly, with 1 exception. If I create a google map or edit a page that has a googlemap as part of it, when I click Preview (before saving the page), I get a list of Error Notices across the top of the page:

Notice: Undefined index: GSmallMapControl in /home/coolpeop/public_html/wiki/extensions/GoogleMaps.php on line 128

Notice: Undefined index: G_HYBRID_MAP in /home/coolpeop/public_html/wiki/extensions/GoogleMaps.php on line 128

Notice: Undefined index: GSmallMapControl in /home/coolpeop/public_html/wiki/extensions/GoogleMaps.php on line 128

Notice: Undefined index: width in /home/coolpeop/public_html/wiki/extensions/GoogleMaps.php on line 165

Notice: Undefined index: width in /home/coolpeop/public_html/wiki/extensions/GoogleMaps.php on line 168

Notice: Undefined index: height in /home/coolpeop/public_html/wiki/extensions/GoogleMaps.php on line 165

Notice: Undefined index: height in /home/coolpeop/public_html/wiki/extensions/GoogleMaps.php on line 168

Notice: Undefined index: controls in /home/coolpeop/public_html/wiki/extensions/GoogleMaps.php on line 168

Notice: Undefined index: in /home/coolpeop/public_html/wiki/extensions/GoogleMaps.php on line 168


However if I save the page with the map on it, it will display and work properly without errors. Only the preview page shows the above. Anyone have any ideas how to fix this? It's going to throw my users for a loop!--71.72.21.196 17:07, 28 August 2006 (UTC)

Anyway to Autoinsert lat/long between tags?[edit | edit source]

Medaiwiki is a bit difficult for users who can barely use a computer, some of them don't understand that that have to have the cursor between the google maps tags when creating a marker and mess everything up which requires a lot of admin work, Im not super familiar with mediawiki but is there a foolproof way to get the lat/long and marker data into the proper tags, maybe through a form?

Version 0.6 does something very similar to what you describe. --Emiller 06:45, 19 September 2006 (UTC)

A problem: Code being output without replacement of substitution stuff[edit | edit source]

Editor's Map comes up, but displaying the page gives stuff like:

%%BEGINJAVASCRIPTd4520279...e3daed4%% function createMarker(point, label) { var marker = new GMarker(point); GEvent.addListener(marker, 'click', function() { marker.openInfoWindowHtml(label); }); return marker; } function addLoadEvent(func) { var oldonload = window.onload; if (typeof oldonload == 'function') { window.onload = function() { oldonload(); func(); }; } else { window.onload = func; } } window.unload = GUnload;%%ENDJAVASCRIPTd452...aed4%%

(I subbed ellipses inside the part that is my key). Any thoughts? --- Sarah
Hi Sarah, what version of MediaWiki are you using? --Emiller 06:46, 19 September 2006 (UTC)

bad_behavior_extension installed? See Talk:Google_Maps_Extension#Not_compatible_with_Bad_Behaviour

Other Google maps - Wikimedia extensions[edit | edit source]

It seems that there's 4-5 other projects for integrating MW/GoogleMaps.

Have anyone tried all of them to see which one that is best/has most features?

[[[w:en:User:Haraldgroven|User:kongharald]]] 9 Feb 2006

Yo![edit | edit source]

This map is working great on our SingletrackWiki

Does anyone know if there is a way to make MediaWiki read template variables that are within extension code tags? such as:

<googlemap lat="{{{latitude}}}" lon="{{{longitude}}}" zoom="1" width="270" height="180" controls="small">{{{latitude}}},{{{longitude}}} {{{description}}}</googlemap>

This way, my template could be called by:

{{Googlemap | latitude = XX.XXXXXXX | longitude = -XXX.XXXXXXX | description = some landmark }}

Instead of the users having to put in all of those coordinates 3 times, they could put them in once and the template would automatically insert them into a "get directions" link, and into the google map extension tags, and create the map.

Any ideas on how this could be done? I know there have been various "mods" or "patches" for mediawiki that were created, but none of those seem to work with the current version.

You can make a template with variables, as you suggested above and use the syntax {{subst:googlemap|lat|lon|desc}}. This will produce the desired output, although it is unfortunately a one shot deal as it copies the text in the page that uses the template when it is saved. Changes to the template will therefore not be reflected on the end pages. This somewhat defeats the purpose, but can at least be used as a tool for users who don't want to mess around with the actual syntax. It still clutters the page, though. Less than ideal. --Charles

Heyup[edit | edit source]

Love it. Pretty straight forward. Of course it would be nice to be able to get a new LAT/LON from messing around with the map, but for now I can paste them in from google links.

However, have you considered letting us specify the colour of the waymarker for the entries we make?

http://www.lundman.net/wiki/index.php/Tokyo

Thanks for your excellent code.

Ohh actually. This is unlikely, but I must admit it would be nice if you have a point, which leads to a page, to be able to have a return link "map" that takes you back (that's easy) and selects/centers the map point in question (harder) ...

Labels on markers don't link[edit | edit source]

Hi, I'm using it with Mediawiki 1.5.6 and am testing with tags like this:

 <googlemap lat="46.415523" lon="-94.283938" zoom="3" controls="large">
 46.415523,-94.283938, Brainerd International Raceway
 </googlemap>

The problem is the wiki link gets converted to Brainerd International Raceway rather than an actual link. Any ideas?

Haha[edit | edit source]

I spend many hours trying to figure out how this works. At first I was under the impression that MediaWiki parsed the wikitext each time. I then found out that it only does it when the page is saved. That is very logical and seems more efficient.

--Schissler--

Labels/Links to point to map?[edit | edit source]

I'm currently using the GISWiki version since it seems not too different than this one. I'll gladly switch if I can get some magic! (I might switch anyway for the English-speaking support).

Basically I have my map at http://mufc.us/index.php/Parks . It's fine, it has the points and you can click on them, etc. What I'd like though is to mimic the actual Google Maps interface where it present a list of items next to the map and you can click on those items to see that point on the map.

For example on my map, rather than having to click on every point to find out where Silver Creek Park is, have a link for Silver Creek Park that would bring it up on the map.

Has anyone tried to do this? I imagine it would be a pretty desirable thing. I'll try to monitor this discussion page, but please email me at don@seiler.us. I have a fair amount of php experience (but not a whole lot of time) if you need an extra set of eyes or hands.

Thanks, Don.

How do i find Lat/Lon[edit | edit source]

How do i take an address and find the Latitude/Longitude needed for the extension? ~jgs

Try a Geocoder.

Example of PinPoint labels[edit | edit source]

See http://www.yelp.com/biz/BM500a4OE7qoHuW8QdfYWw?utm_campaign=local&utm_medium=organic&hrid=PoAsx55C8LJi-AHQbgScXw&utm_source=google for a quasi-example of what it is I'd hope to have. Labels outside of the map that interact with the map. I'd settle for clicking on a label-link and having the map center on that pin-point and open its balloon-label.

Also, do we still have to edit the skin for this module? The Installation instructions don't say so, but the Upgrading instructions do.

Not with the latest version; the upgrading instructions tell you how to un-edit the skin files. --Emiller 18:25, 9 May 2006 (UTC)
Ah yes I finally migrated my wiki over to your extension. Very clean. --DonSeiler 18:26, 9 May 2006 (UTC)

Hopefully I'll migrate to this module from the GISWiki version soon.

Done! Added to the Examples list. --DonSeiler 18:26, 9 May 2006 (UTC)

Feature requests[edit | edit source]

Be aware that I'm only going to code up features that I want for my own wiki. However, I'm very happy to accept any patches that:

  1. seem useful
  2. don't add complexity to the process of creating a minimal map
  3. have been tested on all major browsers

If you have a good idea for a feature, or have implemented a good feature, describe it here! --Emiller 19:40, 9 May 2006 (UTC)

Labels/Links[edit | edit source]

I'd really love to see the ability to click on a text link outside of the map and have it focus the map there, like I've described here a couple of times already. Perhaps I'll take a look at things and see what I can contribute. Let me know if you don't really follow what it is I'm asking for. --DonSeiler 20:13, 9 May 2006 (UTC)

Selectively load markers[edit | edit source]

Only load those markers which are in the viewable area as described here

Info balloon tabs[edit | edit source]

Like here. Might just be eye candy, I'll see if I can work it in and patch.

Perhaps add a pipe delimiter in the description for tab separations.

Google Earth Add On[edit | edit source]

It would be cool if you could write the extension so that users could download the map they see as a google earth (*.kml/*.kmz) file. The map would show a link saying 'save as Google Earth' or what ever and when they download the file they can view the same map in Google Earth.

I don't know if this is possible or how hard it would be to do I just thought it would be a cool feature.

I like this idea. --Emiller 07:23, 19 September 2006 (UTC)

Custom markers[edit | edit source]

Have added some code to this great extension, which make it possible to use custom markers. See User:Modjo/GoogleMapsExtension for more information.

Geocoding[edit | edit source]

google maps can do geocoding now (see http://googlemapsapi.blogspot.com/2006/06/geocoding-at-last.html )

it would be nice to have an option to give an address instead of coordinates for each location

Yes that would be nice

Slow execution?[edit | edit source]

Since upgrading from 0.2 to 0.4, using FireFox, my map now loads so slowly, i am interrupted three times with this dialog:

Warning: Unresponsive script


A script on this page may be busy, or it may have
stopped responding. You can stop the script now, or you
can continue to see if the script will complete.

I have only 211 points on my map and plan to add many more. Is there a way, during the function block:

   for($i=0; $i < sizeof($points); $i++) {
   ...
   }

to allow the process to breathe, like a Yield() call or something?

Here's my map: http://www.ktunes.net/wiki/index.php/Map.

Thanks.

--Davecotter 18:46, 12 May 2006 (UTC)

Interesting. An unresponsive script is a client-side problem, so changing the part you mention won't fix it. The only change between those versions that might affect performance, as far as I can tell, is the use of version 2 of the Google Maps API. I wonder if that slowed things down for some reason? I'm really not sure. I did stumble across this: http://www.acme.com/javascript/#Clusterer, which might speed things up by consolidating some of the points. I haven't tested it, but if it works I'll incorporate it into the extension. Feel free to give it a whirl if you're up to it. --137.165.217.4 19:16, 13 May 2006 (UTC)
I haven't had any real problems with 0.4. Of course I only have 6 points. I don't think the word "only" can be applied to 211 points. --DonSeiler 16:57, 15 May 2006 (UTC)

--James Humphrey

I have the same problem with a new application of mine at:

http://www.tennismaps.com/index.asp?regionid=1

There are 114 points and it is taking 10-15 seconds to load the page in Firefox and around 30 seconds to load in IE. I do not accept that 114 or 211 is too many points to use on a map. It makes me wonder just how heavy these point objects are. I haven't found a solution yet, but have just started looking. I see that ktunes still has the problem.

The problem is that there is a "click" listener for every point on the map. The correct way to do this is to have one listener on the map that opens the balloons on behalf of each marker. The next version, which is in the works, will do this correctly. --Emiller 07:11, 23 August 2006 (UTC)
Version 0.6.0 fixes this problem by creating only one click listener for each map. You should notice a significant performance improvement. --Emiller 06:57, 19 September 2006 (UTC)

Still slow with 0.6.0[edit | edit source]

Just upgraded and it's still too slow, i still get that dialog above (tho this time only once). There must be something that can be done about this?
Davecotter 19:35, 4 October 2006 (UTC)

Polylines to show a path?[edit | edit source]

Works great, love the script. Is there any support for polylines or marking paths?

No, but that would be a great feature if anyone wants to tackle it. --Emiller 02:34, 7 July 2006 (UTC)
Check out version 0.6.0 --Emiller 06:41, 19 September 2006 (UTC)

Ok for Non Technical Users?[edit | edit source]

I'd like to use this on my site, but it looks technically beyond me. I barely get html, and know next to nothing about java or php. Is this something I can do, or should i get someone to help? And if I need to get help, how would I find someone qualified? Thank you for your assistance. --Natcolley 14:21, 26 May 2006 (UTC)

Complaints/Suggestions[edit | edit source]

I appreciate the code update. However, I'm concerned that it is getting a bit bloated. Earlier versions were much easier to read. If I hadn't already been familiar with a previous google map extension I would probably have been a bit overwhelmed. I have basically deleted about half of the code so that it is a bit more manageable and extendable. I'm just hoping that future versions don't continue to add large amounts of code and features to this that I do not need. Other than that I love the extension. Dave Schissler

Hi Dave, I appreciate the feedback. Funny how things meant to be simple soon suffer from feature bloat! But in this case I'm not sure anything is terribly extraneous. I've tried to keep the code organized, at least, but code comments are lacking. I'll try to add some more comments to make the extension more comprehensible. --Emiller 02:40, 7 July 2006 (UTC)

Solving an HTTP_HOST and api key issue[edit | edit source]

I have a lot of domain names linked to my website (I know I should redirect all of them to one url, anyways). The google map api brings up an annoying window if the http_host server variable is not the same one that you used to sign up for the api. I added another variable to LocalSettings and then added the following lines of code.

In LocalSettings.php

$wgGoogleMapsHTTP_HOST = 'www.baseball-reference.com';

In GoogleMaps.php, I added the following in googleMaps_EditForm()

if ($_SERVER["HTTP_HOST"] != $wgGoogleMapsHTTP_HOST) {
  $output = ' ';
  return;
}


I added the following in googleMaps_Render($source, $argv). I put it after the defaults were set.

if ($_SERVER["HTTP_HOST"] != $wgGoogleMapsHTTP_HOST) {
  $output = '<DIV STYLE="border: solid; padding: 10px; width:'.$o['width'].'px;  height:'.
   $o['height'].'px; ">In order to see the map you must have the <TT>'.
   $wgGoogleMapsHTTP_HOST.'</TT> url in your browser bar</DIV>';
  return($output);
}


you also have to add $wgGoogleMapsHTTP_HOST to the lists of globals in the subroutines.

Here it is in action.

Love the extension btw.

Interesting. What would be even better is an array of map keys for a number of domains, and it would pick the appropriate one to use based on the request. (Or show a blank if there's a mis-match.) --Emiller 07:23, 19 September 2006 (UTC)

Great, thank you![edit | edit source]

Great extension! Using it here: http://www.burkina.at/Satellitenkarte -- Helge 18:47, 29 June 2006 (UTC)

So after using it some time, here my feature suggestions:
- a "zoom in" link would be cool. example see here: http://www.2raum.at/lage.html
- custom markers would be cool, too.

I have added a bit of code to make this possible see User:Modjo/GoogleMapsExtension --Modjo 00:00, 31 August 2006 (CET)

- Helge 11:36, 1 July 2006 (UTC)

Brilliant[edit | edit source]

I'm in love. This was incredibly easy to install and even easier to use!! Wow...

I would like to second the request for ability to draw paths, it would be fantastic for recreating bike paths and the like.

Thanks!!! --pfctdayelise 14:36, 27 July 2006 (UTC)

You got the paths, if you'll give Version 0.6.0 a whirl. --Emiller 07:23, 19 September 2006 (UTC)

Hm, my feature request: allow the possibility of overriding the default values for a single page only. ie. in that page insert some new tag with new default values, that apply to editing that page only. Why? Because I'm using this to find geo coords for Wikipedia. It's way faster than any other method I've seen, for smaller structures such as buildings or parks. But it does mean I can pretty much only work on one city at a time, unless I set up multiple MediaWikis which doesn't seem like a smart idea! Did this make sense? I know it's probably not reasonable, but hey, I can try. :) --pfctdayelise 16:20, 27 July 2006 (UTC)

This is a reasonable feature request. I think the right way to do it would be to make the config look like:
  $wgGoogleMapsDefaults = array( "Main Page" => array("lat" => 13.48041, "lon" => -42.3184 ),
                                 "Montreal" => array("lat" => 42.2811, "lon" = -19.3910 ) );
and have it figure it out from there. Don't think I'll have time to do this, but I'll certainly accept a patch... --Emiller 07:23, 19 September 2006 (UTC)


feedback[edit | edit source]

Wow, excellent stuff. I just discovered this extension after breaking the extension I was using, and am glad I found it! Since I bet you've got nothing to do... What about an option to get rid of the map type chooser? They take up a lot of space, and on a thin map (300px) they cover up the zoom controls. (I'm using it for an area that doesn't have any detailed satellite images...)

Here's hoping you keep up the great work! —Alxndr (t) 05:51, 22 August 2006 (UTC)

Hi Alxndr, based on your suggestion, I've made this an option in version 0.6.0. Check it out! --Emiller 06:43, 19 September 2006 (UTC)

Google Maps Extension breaking Semantic MediaWiki?[edit | edit source]

I'm trying to use Semantic MediaWiki and the Google Maps Extension on the same page. I'm not sure exactly what is going wrong, but some of my Semantic MediaWiki "ASK" queries are not runninng, and are instead appearing as strange strings like "�UNIQ15bccbbf7420c541-ask-79e3e9e24c83514200000001-QINU". This only happens on pages that contain both Sematic MediaWiki "Ask" queries and a Google Maps Extension map.

Looking through the MediaWiki code it seems that this strange UNIQ...QINU string is created and would be replaced by the parser script, so I'm guessing that something about that parser script is not running correctly.

Later, looking at the Google Maps Extension code, I see some code with the following comment:

        // This function lets us insert wiki markup into the map markers.
        // (it doesn't do all of the cleanup as the regular parse function,
        // which we eschew because it calls some hooks that we only want to run
        // once)

Is it possible that the google maps code skips some aspect of normal parser functionality? If so, is there anything I can do about that?

Thanks!

--TaoKlerks 2006-09-03 21:48

Tao, try out version 0.5.5. It should solve your problems. --Emiller 03:24, 19 September 2006 (UTC)

UNIQ tags and compatibility[edit | edit source]

I inserted at line 206 (above the $pOutput declaration):

$localParser = new Parser();

And modified the $pOutput declaration as follows:

$pOutput = $localParser->parse($label, $wgTitle, $wgOut->mParserOptions, false);

The main thing to change was to no longer reference the global parser but instead a new instance of one. According to the MediaWiki extensions FAQ#Alternative approach to extending Wikitext, calling parse() twice is no longer applicable. Doing so destroys all other processed tags (turns them into the internal UNIQ tags). I noticed a lot of my extensions were doing this and thought that they had a problem, but it was simply because they were being called before the GoogleMaps tags. Any custom tags ABOVE the googlemaps tag will be destroyed.

This should correct the issue listed above with Semantic MediaWiki.

I hope this helps, I love this extension and have it running on my 1.6.7 installation. --BakerQ 14:09, 4 September 2006 (UTC)

Thanks for sharing the tip! Version 0.5.5 applies a similar fix, but is more efficient in that it instantiates only one parser per map, instead of one per point. Try it out! --Emiller 16:45, 9 September 2006 (UTC)

Basic Icon Classes (custom markers)[edit | edit source]

Thanks for the extension, excellent. However, I wanted to label a number of things on a page using custom labels to refer to the markers so I modified version 0.5.4 to allow for it:

What I've done is:

  1. Changed the way the points are read so that if there are 4 items in the CSV list then the first item is taken as a letter to use as a tag (note: only uppercase letters can be used because they are Google Map's standard markers: www.google.com/mapfiles/marker + <letter> + .png
  2. Changed the JS createMarker() function so that if a custom label is passed it will create a GMarker with a custom icon using that label.

Example (with 2 custom markers 'A' & 'B' and a non-label marker):

<googlemap height="550" width="550" align="center" lat="-35.316859" lon="150.436349" zoom="17" controls="medium" type="map">
A,-35.316859,150.436349,Amanda's Coffee Shop & Deli
B,-35.316675,150.435555,Annabel's Cafe
-35.316937,150.435963,Cafe Java
</googlemap>

(note: labels and non labels can be mixed on the same map as each one is parsed separately)

Based on Google Maps API Documentation Using Icon Classes

I'm sure this idea could be easily extended even further but this does what I want ATM.

-- Rod @ Ulladulla Wiki, 9 September 2006

Additonal Funcionality added to Version 0.5.4[edit | edit source]

Great work! Thanks!

I've created Bonwiki using this extension. A snap to install, use and modify.

Checkout User:Rburnham/Google_Maps_Extension for the modified code.

Is the base version supposed to allow more than one map per page? Code seems to imply this, but does not work for me...no big deal.

Feel free to use it, just not abuse me for any coding crud! I'm very new to PHP and maybe an advanced novice at javascript. Will definitely need work if it is to be made to work with more than one map per page.

My version adds:

  • Default map size changed to 500 x 500 and uses small map controls with the inset navigation map.
  • On mouse over a map marker, popup the label for that marker (tooltips).
  • Round inserted lat/lon to 6 decimal places.
  • In editing, "show map" attempts to find an exiting map defined in the wpTextbox1 div and parse out the existing lat, lon, zoom, width and height. Create the edit map using any of these that are found.
  • Enabled double-click zoom in/out (enableDoubleClickZoom) and continuous zoom (enableContinuousZoom) in all maps.
  • Enable marker dragging in the edit map.
  • Added a div above any map that always displays the lat,lon of the center of the map (addListener for moveend).

-Blennylips 21:35, 15 September 2006 (UTC)

Cool additions, Blennylips! I'd love to integrate some of these features into the main version. I'm not so sure about displaying lat/lon above every map, but it'd be great if you (or someone) figured out how to make options for:
  • the inset navigation map
  • continuous zoom
  • double-click zoom
It shouldn't be too much extra work. I think the tool-tip shouldn't be an option; that's just a good idea. --Emiller 07:23, 19 September 2006 (UTC)

Not compatible with Bad Behaviour[edit | edit source]

After installing the bad behaviour extension to my wiki the google maps extension no longer renders the maps.

Is this a known bug and is there any fix to it.

Clash with Gallery2Wiki extension[edit | edit source]

It is not possible to have this extension installed and working with the Gallery2wiki extension.

Installing Gallery2Wiki and Google Maps Extension results in a javascript error for the the Google Maps Extension - ie any page with an installed Map.

This is the error you get (example page):

%%BEGINJAVASCRIPTc73ecb6178fea1843a5ad1d5b1126694838eec99b0051c1f18594cd49d56119f%% function createMarker(point, label) { var marker = new GMarker(point); GEvent.addListener(marker, 'click', function() { marker.openInfoWindowHtml(label); }); return marker; } function addLoadEvent(func) { var oldonload = window.onload; if (typeof oldonload == 'function') { window.onload = function() { oldonload(); func(); }; } else { window.onload = func; } } window.unload = GUnload;%%ENDJAVASCRIPTc73ecb6178fea1843a5ad1d5b1126694838eec99b0051c1f18594cd49d56119f%%

0.6 Doesn't work??[edit | edit source]

Notice: Undefined index: units in /wiki/extensions/GoogleMaps/GoogleMaps.php on line 283
Notice: Undefined index: scale in /wiki/extensions/GoogleMaps/GoogleMaps.php on line 283
Notice: Undefined index: selector in /wiki/extensions/GoogleMaps/GoogleMaps.php on line 283
Notice: Undefined index: units in /wiki/extensions/GoogleMaps/GoogleMaps.php on line 110
Notice: Undefined index: scale in /wiki/extensions/GoogleMaps/GoogleMaps.php on line 110
Notice: Undefined index: selector in /wiki/extensions/GoogleMaps/GoogleMaps.php on line 110
Notice: Undefined variable: wgScriptPath in /wiki/extensions/GoogleMaps/GoogleMaps.php on line 120
Notice: Undefined variable: wgScriptPath in /wiki/extensions/GoogleMaps/GoogleMaps.php on line 121

note: i've edited the paths above to shorten them to just the wiki
Davecotter 19:28, 4 October 2006 (UTC)

Problems with Internet Explorer - how to fix them[edit | edit source]

I'm using Mediawiki 1.7.1 with Monobook skin. I got Javascript parsing errors using IE. I discovered that in addition to patching includes/OutputPage.php it is necessary to patch skins/MonoBook.php.

The patch is contained now in the installation manual.