Extension talk:Google Maps/Feature requests

''This is a discussion page for Google Maps Extension; if you're having trouble installing or have a feature suggestion, this is the place. Please sign your comments by typing --~ at the end of your contribution, and be careful not to delete what other people have said. See also the archive for older/fixed issues.''

Be aware that developers are only going to code up features that they want for their own wikis. However, we're very happy to accept any patches that: 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)
 * 1) seem useful
 * 2) don't add complexity to the process of creating a minimal map
 * 3) have been tested on all major browsers

Anyway to Autoinsert lat/long between tags?
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)

Labels/Links
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)


 * Something that might suffice in the mean time is Icon Classes. You can see the demo from that link as well.  Just a way of making a visual connection from a text label outside of the map to a marker on the map.
 * http://www.econym.demon.co.uk/googlemaps/basic2.htm has what I actually want. I'll dig around.

text links to Markers... A start
I used to use the Mafs Google Maps Extension and have recently switch to your extension, love it! I made an update to the Mafs so outside links could open Marker info boxes. I took a quick look through your code but it is very grand and will take me many hours to figure the code and where to put it. So... Here's the code I added to Mafs... maybe someone a little more familier with Emiller's code can make it work here?

This is how the javascript is called through links $data .= "(Map) ";

This Javascript function picks up the click and opens the corresponding info window var gmarkers = []; function myclick(i) { gmarkers[i].openInfoWindowHtml(' ' + gmarkers[i].my_html+' '); }

This fills the info into gmarkers var html = ' ' + title + ' '; marker.my_html = html; marker.my_name = title; marker.my_lon = lon; marker.my_lat = lat; gmarkers.push(marker);

Hope this helps!

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

Google Earth Add On
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)


 * Hi i am the original poster of this idea. I have started to code this and I am very close to getting there. Once I have debugged the code I will release it to you to include in the google maps extension. (I am writing it as a special page that will export a map from a chosen wiki page) --158.125.9.4 14:04, 20 January 2007 (UTC)


 * I look forward to it! --Emiller 06:30, 21 January 2007 (UTC)

Hi. if we have titles on mouseover, i think you could add an option to when we click on the placemark, appear the wiki page, like Rick Google Maps. This option could be added when we edit the placemark on a page. So we could choose to show balloon or the page. I saw an interesting page, maybe can help on other things http://www.econym.demon.co.uk/googlemaps/ What do you think?

Hi George, have an option to export to kml in Google/Maps will be great. As you said, a link at the bottom of the map. Waiting for this. Thanks. Could have the option to find the coordinate too. Integrated with the extension. What do you think? Lleoliveirabr 15:00, 27 January 2007 (UTC)


 * A option to search for a coordinate would require you to search the entire database for a string. Also if it was say one number different it would not return results expected. For that reason I don't think that would be a worthwhile feature. --George Drummond 15:30, 27 January 2007 (UTC)

kml output would be great, because google would start indexing the kml-files for geo searches. JanCK 11:35, 19 July 2007 (UTC)


 * Check out the new in 0.9. Example usage:

View in Google Earth
 * That will export all the maps in the "Chicago" article. --Emiller 20:37, 27 February 2008 (UTC)

Google Earth file as input
I just noticed that you can copypaste the URL of a kmz-file into the search-field of maps.google.com. So awesome! The same feature would be great for this extension. Two usecases:

http://cms.ostby.de/Portals/20/GoogleEarth/Goldsteig.kml

(could be achieved by copypasting URL into search field.)



(I.e. upload of file.) --Helge 13:25, 15 November 2006 (UTC)


 * I had a quick look into this and you cant currently upload a kml file in mediawiki. Something to do with it being an xml file and exploits. Another option however would be to use kmz which is basically a zipped kml file (Mediawiki seems to allow this). You could unzip it on the fly and then convert the xml into arrays and then javascript to display the map.--George Drummond 22:04, 24 January 2007 (UTC)


 * I thought you can change the supported file formats in LocalSettings.php.

$wgFileExtensions = array('png','jpg','jpeg','ogg','doc','xls','ppt','mp3','sxc','pdf','nse','odt','ods','gif');


 * But you'll also need to register the mime type in the system. And I wasn't able to do so with the help of .htaccess . Thought this should have been possible, theoretically. JanCK 09:58, 24 July 2007 (UTC)


 * The first use-case (pasting a URL) is available in 0.9. After installing Google Maps Extension, you can upload KML and then point to the URL directly. The [[Image:Foobar.kml]] syntax is not (yet) supported. --Emiller 20:24, 27 February 2008 (UTC)

Geocoding
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


 * You got it! Check out Version 0.7


 * While this is a very nice feature I'd like to be able to turn it off in LocalSettings.php. Geocoding works in very few countries (US and UK, to my knowledge), and for major cities in some others. In Burkina Faso, the African country my wiki focuses on, only the capital name can be searched for. So I'd like to turn it off to reduce clutter. --Helge 15:35, 26 October 2006 (UTC)


 * That's a good point, Helge. I've made the search features optional in Version 0.7.5; see Extension:Google Maps/Installation. --Emiller 06:19, 8 January 2007 (UTC)


 * Cool! By the way: In the meantime geocoding has been implemented for a lot of european countries (FR, DE, AT, etc.). --Helge 14:55, 4 March 2007 (UTC)

"Zoom In"-Functionality
I'd love to be able to add a "zoom in" link to bubbles. I.e. sth like. This could be a fixed link that is part of each bubble (with the possibility to turn the function off). Either way I would like to be able to set the target level (per map, not per bubble). The zoom-in-link would turn into a zoom-out-link after zoom. Would really be cool! --Helge 21:03, 26 October 2006 (UTC)

Compatibility with Custom Map Tiles
I'd really like to use this with a custom map (like the ones being talked about at .  But, all examples I've seen just give the raw jscript, and it isn't clear to me where to edit this info into either GoogleMaps.php or EditorsMap.js.  Am I missing something? Has anybody done this with custom maps? Thanks.--Dave Younce 04:54, 12 December 2006 (UTC)

Me too, I would like to see that happen too. I'm just setting up a little wiki for my pen'n'paper rpg- group and since I stumbled over this extension I'm very excited about it - imaging having all that nice maps our game master drew in a wiki and even am able to create wiki- links out of them... I just created map tiles and tested it, next step would be, getting it running with this extension. Did anything happen yet? I also see no light at the end of the tunnel, looking at the code... ... (Benedikt)

Add map on page, but show only when user request it
Sometimes people that browse the wiki don't want too see the maps all time. example: because connection is slow. What do you think? Lleoliveirabr 13:53, 24 December 2006 (UTC)
 * I would like to request a feature that i think it's very important.
 * I'm creating a wiki page that all pages will have a map showing a place. Example: bar, church...
 * So i really think interesting have an option to show the maps in hide mode, only downloading the map in the moment the user click "show map"

Be like Ricks Google Maps Extension
Hi, i would like to know if google/maps will have the same features of rick google maps extension, with option to filter results by categories and.. many other things. I really would like to see GM with it, as Rick GM is never released. Lleoliveirabr 02:27, 8 January 2007 (UTC)
 * Yes, that would be great. Also I don't want to create a map for every category and add points several times. It would be great if i can create one map with all points and than show on every category page a map with the points that belong to this category! But I thinks this is not possible, because you store your information in the wikitext and not in a database!--Onko 06:58, 18 January 2007 (UTC)

Allow specify line width & opacity on paths
It would be nice to allow to specify the line width in paths, or even opacity. something like:


 * 1) FF0000,2,0.7

Where you have, , for the path.

Dan
 * I like it. --Emiller 06:58, 18 January 2007 (UTC)
 * Implemented in 0.9.0. See Extension:Google Maps/Syntax. --Emiller 08:45, 21 February 2008 (UTC)

Support polygons
As described in the Google Maps API reference. Perhaps this could just be an extension of the line syntax, e.g.


 * 1) FF0000 0.7 2; #00FF00 0.2

--Emiller 06:58, 18 January 2007 (UTC)


 * Implemented in 0.9.0. See Extension:Google Maps/Syntax. --Emiller 08:46, 21 February 2008 (UTC)

Any chance for a Directions To/From feature?
Any chance of having a "Get Directions: To and From" feature when we click on the marker?
 * If anyone wants to write this here is some info --158.125.9.4 18:44, 25 January 2007 (UTC)

Show and hide labels
As you want to implement in the next version title and description on placemarks, I think it's interesting implement an option to show and hide labels "labels = titles". This could be on top of Map, like Rick Google Maps. What do you think?

only allow the extension on certain pages/namespaces
I noticed the edit pages load longer with this extension. Two ideas of restriction based on article name:


 * 1) example.com/wiki/Pagetitle/gmap
 * 2) example.com/wiki/Gmap:Pagetitle

So people that do not like Google at all could also avoid browsing in the Gmap namespace or to pages with /gmap.

Tobias Conradi 01:42, 9 February 2007 (UTC)


 * The edit page slowness will be fixed in the next version. --Emiller 20:26, 27 February 2008 (UTC)

Support merging of maps
The abbility to merge maps would be nice. E.g. in a wiki about a town there is a map with theaters and a map with bus stations. Now it would be nice to merge these maps together, so that one can select which markers one would like to see (either from the theater map, from the bus stations map or both). The usage of the original markes in the merged map when they differ would be nice, too. The selection of the merged maps could haben with respect to categories. E.g. from all pages that belong to the map category. --134.130.4.46 17:00, 19 February 2007 (UTC)


 * This can be done by exporting and importing KML, available in 0.9.0. --Emiller 08:46, 21 February 2008 (UTC)

Show coordinates of added markers
On http://wikipaddle.org/wiki/Special:CoordinateFinder there is a nice application that allows to get the coordinates of a marker. Can you please add something like this to this extension? I asked tried to ask the author whether he plans to include this here or provides a download but he was only rude to me. Maybe someone here can ask him, because he seems to be an active user here, too. Or even better: implement this :-) --134.130.4.46 09:48, 22 February 2007 (UTC)
 * In edit mode, the coordinates are in gray at the bottom of each marker's info balloon. --Emiller 03:23, 27 February 2007 (UTC)

Compile markers from subcategories
If a user adds a map for something in a city... which is a subcategory to a state... it could be interesting if the map shown for the state included the markers from the city.

Basically, can we setup a map that pulled markers from their sub-categories?

Edit... Took a look at how this was setup and can see where this request would be pretty difficult to do. So on to a new question... instead of having the marker info stuck in the article (page) text that's then stored in the database, could there be a database created for the maps / markers?

Example of how it could work (I have no idea if it's realistic since I know just enough to get into the SQL interface and royally screw my site up)...

When creating a map instead of displaying the wiki text with all of the map information that goes in the article, just have it identified as "map####"... then the map details (size, type, center point, etc) and all relevant markers get dumped to the server database. The database includes a "page found on" reference as well.

Assuming that this is possible, you could then "export" data from the database into an kml compliant file. Also, by defining some basic restrictions, you could import a kml file to the database.

Since you've got a page reference for each map, some work could be done to roll markers from a article page to the higher level category and compile them.

Another possible cool thing (assuming the original thought is even possible) is that a site could run a server side operation so that once per week it jugged through the data and created a massive kml file (or smaller one depending upon what you told it to compile) of all the maps on the site. What's the use of this?... sharing. Others could download the file for google earth... others could just embed a link to it from their own online map. Maybe it'd be possible to put the kml file in a directory that was password protected and the linking to it only worked if the correct password was given (and you could charge for people to have that password if you've got a really great map).

Graydon 07:41, 2 May 2007 (UTC)

internal function
Is it possible to write a function that would take the address, city, zip code etc as a variable and return the google map tags  i.e lat =***,lon=****.

the function would reside on another extension and just include the google map.php file

An even bigger bonus would be to take a uk address or postcode and return the tags. I understand that this has to be done using the googleajax api, using something like this

http://www.tomanthony.co.uk/blog/geocoding-uk-postcodes-with-google-map-api/

Custom sizes for custom markers?
Hi there,

Would it be possible to include some syntax so that the size of the custom marker icons could be changed? Something like iconwidth and iconheight or something? I want to use custom markers with the extension but I'm limited to the standard icon size of 20x34 at the moment. I know it's possible to change if you have access to the GoogleMaps.php file, but I don't on my wiki which is hosted by wikihost company.

In particular, it would be great to be able to use the icons shown on this page. 220.157.223.97 13:44, 9 July 2007 (UTC)

Creating Dynamic Maps with Semantic Wiki Extension
I use semantic media wiki and had the idea of creating dynamic maps based on using the inline query capability.

There are 2 problems.


 * 1) The precision of the float attribute based on a query
 * 2) The ask query working within the google tags

My approach was to create several templates that put the information is the correct order. If you use the transliteration capability of a template it displays


 * 30.532 -91.157, Baton Rouge Metropolitan Airport - my example


 * The attributes Latitude and Longitude are stored with the correct precisoin 30.407627, -88.91779

The idea was to generate the map this way and use more elaborate inline queries. 

Any thoughts as to how to make this work? - User:pdavis39 22 July 2007

Pass-Through styles
I understand that it is possible to set the width/height of the wrapping div. I would like to be able to pass any styles I want with the syntax: &lt;googlemap width='300' height='300' type='map' lat='32' long='-72' style='border:3px inset blue;margin:1em;background:#ffe;'&gt; I have performed a cursory scan of the code and this does not seem to be a difficult thing to do. If it is simple, I will post the diffs here so, if anyone else likes this feature, they can implement it. If a lot of people like it, it can be merged into the main extension. Kainaw 15:35, 11 September 2007 (UTC)


 * It was easier than I thought. Here's the diffs:
 * Line 369:

-$output .= '&lt;div id="map' . $this-&gt;mGoogleMapsOnThisPage . '" style="width: ' . $o['width'].'px; height: ' . $o['height'].'px; direction: ltr;"&gt;&lt;/div&gt;'; +$output .= '&lt;div id="map' . $this-&gt;mGoogleMapsOnThisPage . '" style="width: ' . $o['width'].'px; height: ' . $o['height'].'px; direction: ltr;'.$o['style'].'"&gt;&lt;/div&gt;';
 * Add after line 741 (which contains ):


 * With those two edits, you can add extra style attributes to the div that wraps the map. I'm interested in borders and floating the div to the right. Kainaw 16:04, 11 September 2007 (UTC)


 * I also just discovered that you can add "width:100%;" to the style. Since I put this after the previously entered "width", it overrides the pixel width, allowing you to have a map that resizes to fit the width of the window. Kainaw 16:11, 11 September 2007 (UTC)

Make this work with the FCKeditor + MediaWiki official integration
Using the FCKeditor and MW 1.10.1 I don't see the button to add a map unless I disable the FCKeditor. Since I want my users to use the FCKeditor (since it's more user friendly) by default, I would love to find a way to simply show a link or something to the map editor either within the framework of the FCKeditor, or anywhere on the page when somebody adds or edits an article.

float support
Hi

I like something like 'float-Support' to have the text on the left and the map on the right.

I patch the code like this: diff -u GoogleMaps.orig/GoogleMaps.body.php GoogleMaps/GoogleMaps.body.php --- GoogleMaps.orig/GoogleMaps.body.php 2007-08-06 10:56:07.000000000 +0200 +++ GoogleMaps/GoogleMaps.body.php     2008-02-22 08:31:15.000000000 +0100 @@ -365,8 +365,16 @@     $output = ''; +   $float = ''; +   if( $o['float'] == 'left' ) { +     $float = 'float:left; '; +   } +    if( $o['float'] == 'right' ) { +     $float = 'float:right; '; +   } +      // output the main dif with the specified height/width/direction -   $output .= 'mGoogleMapsOnThisPage . '" style="width: ' . $o['width'].'px; height: ' . $o['height'].'px; direction: ltr;"> '; +   $output .= 'mGoogleMapsOnThisPage . '" style="' . $float . 'width: ' . $o['width'].'px; height: ' . $o['height'].'px; direction: ltr;"> '; // The Google Maps API shows polylines incorrectly in IE if the direction // of the Map is RTL. So for RTL languages, we set the map div to LTR, @@ -668,6 +676,11 @@                           'recenter', 'zoom' ), +       'float' => array( +                         'none', +                         'left', +                         'right' +                       ),        );      } @@ -739,6 +752,7 @@        'width'       => 400, 'zoom'       => 12, 'zoomstyle'  => 'fast', +     'float'       => 'none', );     // if no map defaults are specified, just return the base set of defaults

The patch ist gpl, like the code.

Maybe you can add this in the orig extrantion.

Thanks Michael'grisu'Bramer --81.169.172.102 07:46, 22 February 2008 (UTC)


 * Well, you can just wrap the map in a floating div:

...
 * --Emiller 20:29, 27 February 2008 (UTC)

Import / Export .GPX
Identical to Import / Export KML, but in GPX format. Could be very simple to modify the existing KML import/export but I wouldnt know where to start. --67.85.243.235 19:14, 27 February 2008 (UTC)
 * Don't know about importing GPX, but making an exporter should be easy. If you want to take a crack at it, check out SpecialGoogleMapsKML.php and GoogleMapsKmlOutputter.php. Together they're only about 200 lines of code. --Emiller 20:32, 27 February 2008 (UTC)


 * If anybody else is interested, replace the contents of GoogleMapsKmlOutputter.php with whats in the box below and change the only instance of $article.'.kml in your SpecialGoogleMapsKML.php file. to $article.'.gpx.


 * This is for Exporting into .GPX Only! The only kink I can't figure out is that the Path/Route is Closed automatically by duplicating the first pair of coordinates at the end of the path, this can be avoided by setting $pPolyline[-1]; instead of 0, but then it makes a final rtept with blank coordinates. For my application, this is acceptable, but for something like Google Earth, importing a GPX with an coordinateless rtept seems to mess with it.


 * I'll Tackle Importing tomorrow, (Unfortunately GPX-outputs aren't as standardized as google's KML is.) I am also still interested in the Ability to Implement Import/Export of KML and GPX Simultaneously, if anybody wants to help. --67.85.243.235 04:22, 28 February 2008 (UTC)

mOutput = ''; $this->mIcons = array; $this->mIcon = $pIcon; $this->mMarkerCount = 0; $this->mLanguage =& $pLanguage; }

function addXmlSource($url) {		$this->mOutput .= ""; }

function addPolyline ( $pPolyline, $pLineColor, $pLineOpacity, $pStroke, $pFillColor, $pFillOpacity ) {		if ($pFillColor) { return $this->addPolygon($pPolyline, $pLineColor, $pLineOpacity, $pStroke, $pFillColor, $pFillOpacity); }		$this->addCoordinates($pPolyline); }

function addPolygon( $pPolyline, $pLineColor, $pLineOpacity, $pStroke, $pFillColor, $pFillOpacity ) { $this->addCoordinates($pPolyline); }

function addPolyStyle($pFillColor, $pFillOpacity) { list($r, $g, $b) = str_split($pFillColor, 2); }

function addLineStyle($pLineColor, $pLineOpacity, $pStroke) { list($r, $g, $b) = str_split($pLineColor, 2);

}

function addCoordinates($pPolyline) { $this->mOutput .= " "; $pPolyline[] = $pPolyline[0]; foreach ($pPolyline as $p) { $this->mOutput .= " 2008-01-01T12:01:01Z Path  \n"; }		$this->mOutput .= " \n"; }

function addMarker ( $pLat, $pLon, $pIcon, $pTitle, $pCaption, $pIsLine ) { $this->mMarkerCount++; $this->mOutput .= " 2008-01-01T12:01:01Z waypoint "; if (is_string($pCaption) && $pCaption) { $this->mOutput .= ' '. GoogleMaps::fixBlockDirection(GoogleMaps::fixTidy($pCaption), $this->mLanguage->isRTL). ' waypoint '; } else if (is_array($pCaption)) { // TODO (?) }		$this->mOutput .= " \n"; }

function addIcon($icon, $template) { $this->mIcons[$icon] = str_replace("{label}", $icon, $template); }

function addFileHeader { $this->mOutput .= "\n"; $this->mOutput .= ""; $this->mOutput .= " CHANGE THE NAME  ";

}

function addFileTrailer { $this->mOutput .= " "; }

function addHeader($name) { $name = htmlentities($name); }

function addTrailer { }

function render { return $this->mOutput; } }


 * This is looking great! Perhaps we should make a new tag called to replace . This would take an extra argument  which could be "kml", "kmz", or "gpx". E.g.,

Download GPX file View in Google Earth
 * Post here when you're done working on export and import and I'll integrate your changes. If you want to work with the latest version of the extension, do this:

svn co http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/GoogleMaps
 * --Emiller