Jump to content

Extension talk:Google Maps/Developers

Add topic
From mediawiki.org

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.

Google Earth Add On

[edit]

This discussion is about a kml-export.


I am unsure how best to implement some features.

Google Earth files have a description and a title. For the moment I have made the wikitext be the description and numbered each point, maybe we could decide on some syntax for placemark titles later on.

For pages with multiple maps I have put each map in a numbered folder when the user wants to export all maps on a page. Maybe we could have map titles in the syntax later on as well.

I also dont know how best to handle tab pages, as this is not possible in KML.

I would value your input on this. --George Drummond 21:54, 22 January 2007 (UTC)Reply

Would it be ok if i introduced a title attribute for each map, so <googlemap title="This is the title"> or something like that? --158.125.9.4 01:09, 24 January 2007 (UTC)Reply
Hi George,
  1. I believe that there's already a "name" attribute partially supported. This is what shows up in the "Load a map" drop-down menu; if it's not present, then it'll say "Map #1", etc. So use "name" instead of "title".
  2. Perhaps each tab could be a separate point in the KML file? Then the title is just the tab title, and the description is the tab's wikitext.
  3. As for normal points, I'm not sure what the right solution is for making a title and description. That's a tough question. Here's a thought. Kinda wild, but I'll throw it out there:
    • If there are no internal links in the wikitext, use the wikitext as the title and description
    • If there are internal links in the wikitext, then make a point for each link. The title is the link text, and the description is the rendered article (or sub-section) that the link refers to. That way, you could explore articles without leaving Google Earth.
  4. Do you need to store the maps on disk when you're exporting them? Could you instead create them in memory and serve it directly? It'll cost some computation time, but I don't think people will export maps very often (relative to loading the Wiki page). For multiple maps, you could put them in a zip file in-memory and then serve them that way. This way, you avoid file permission issues on the web server.
--Emiller 04:52, 24 January 2007 (UTC)Reply
  1. Sounds good, will use that.
  2. A different place mark for each tab can make the map look messy, for the moment I have written each tab to the description with a <hr /> in between them, making a line.
  3. For the title could we maybe introduce a new syntax ( maybe some thing like !!title!! ) or something:
    • (S) 42.711618, -73.205112, the fabulous, famous Sawyer Library !!Sawyer Library!! - or something like that?
  4. I am making each map dynamically at the moment so no files are stored on the server. For pages with multiple maps, I want to make it an option to download every map on the page in one file with each map in a folder (not actual folder but one within google earth) or download each map individually.
  5. At the moment internal links are causing me a problem as I dont know how to render them as absolute links instead of relative. At the moment I am getting;
/wiki/Extension:Google_Maps
But i want:
http://www.mediawiki.org/wiki/Extension:Google_Maps

Cheers --George Drummond 08:50, 24 January 2007 (UTC)Reply

I have an example on my wiki now. On the Special page type in the name of a page with a map and a google earth file will appear to download. It isn't finished yet as I want to make some changes on icons and make it compatible with every wiki.

It could be built into the maps if you put a link at the bottom of the map. --George Drummond 10:31, 27 January 2007 (UTC)Reply

Very nice, George! I can open it right in Google Earth.
I was thinking some more about the title/description problem. It also makes sense for points in the Google Maps API to have titles and descriptions; you can make the titles show up as Tooltips on a mouseover, and then show the title + description when you click a point, similar to how Google Earth works. Here's the format I was thinking of:
latitude, longitude, marker title
optional description
latitude, longitude
latitude, longitude, marker title
/tab title\ tab description
/tab title\ tab description
So for example:
-42.34982, 28.3481, Sawyer Library
Many [[students]] study here every day of the week.

In fact, some people sleep here!
This gives us a side-benefit of multi-line descriptions. It's also more compatible with the existing tab syntax; currently if you have tabs and a caption, the caption is simply discarded.
The downside is that, well, it changes the syntax somewhat fundamentally, since the things that people have been entering to go in the balloon will now become the tooltip. But we could do this: if there's a description, then put the title in bold and the description below it. If there's not a description, only put the title in the info balloon, just like it currently works. I like this solution because it shouldn't get in anyone's way, it increases the flexibility of what people can do with balloons, and simultaneously solves the KML title/description problem. What do you think? --Emiller 17:06, 27 January 2007 (UTC)Reply
I like the idea of title on first line and second line as description. We could make a change to EditorsMap.js to have two input boxes, a one line one for title and one like we have already for description. --George Drummond 17:37, 27 January 2007 (UTC) (also can we somehow archive this page as its really long)Reply
I have made a few mock ups of how we could do this, i dont think it would look too bad if users had no title and description at the moment see my User page. Also I have made a mod on EditorsMap.js to show how this feature could work - Example editors code (only tested on firefox 2.0 mac, dont have ie, wont work on safari anyway)
Is there some version of this, that I could try? I'd really like my maps to be indexed by google. ... As far as I understood some youtube google talks, it is important to name the kml file suggestively. Maybe one could implement an option to choose the file name of the kml file. Thanks, en:User:JanCK 10:58, 23 July 2007 (UTC)Reply


Additonal Funcionality added to Version 0.5.4

[edit]

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)Reply

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)Reply
I've added several of these features to Version 0.7.0, including rounding, marker dragging, and parsing wpTextbox1 for map attributes. Still no continuous or double-click zoom. Thanks! --Emiller 03:10, 22 October 2006 (UTC)Reply
  • To get click zoom and continuos zoom as an option change:
    function makeMap{$wgGoogleMapsOnThisPage}() {
    if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map{$wgGoogleMapsOnThisPage}"));
        map.setCenter(new GLatLng({$o['lat']}, {$o['lon']}), {$o['zoom']}, {$o['type']});
        GEvent.addListener(map, 'click', function(overlay, point) {
            if (overlay) {
                if (overlay.tabs) {
                    overlay.openInfoWindowTabsHtml(overlay.tabs);
                } else if (overlay.caption) {
                    overlay.openInfoWindowHtml(overlay.caption);
                }
            }
        });
END;
	if ($wgGoogleMapsClickZoom) {
		$output .= 'map.enableDoubleClickZoom();';
	}
	if ($wgGoogleMapsContinuousZoom) {
		$output .= 'map.enableContinuousZoom();';
	}
The set $wgGoogleMapsClickZoom or $wgGoogleMapsContinuousZoom to true to enable. --George Drummond 23:52, 24 January 2007 (UTC)Reply

Suggestion on editors map

[edit]

I think it would be an idea to change the following code in EditorsMap.js to make the wiki text produced clearer to the users.

Line 502

	       this.map_dump_div = document.createElement("div");
	       this.map_dump_div.setAttribute('id', 'map_dump');
	       this.map_dump_div.style.padding = "0px 10px";
	       this.map_dump_div.style.fontFamily = "Courier";

to just

	       this.map_dump_div = document.createElement("pre");

--George Drummond 00:01, 25 January 2007 (UTC)Reply

Good call. I'll include it in the next version. --Emiller 04:27, 25 January 2007 (UTC)Reply

No need for function googleMaps_CompareVersions

[edit]

PHP has a native version_compare() function since PHP 4.1.0 that performs the same job, but a bit faster. --Hholzgra 23:53, 25 December 2006 (UTC)Reply

Thanks for the tip! I got rid of googleMaps_CompareVersions in favor of version_compare() in Version 0.7.5. --Emiller 06:22, 8 January 2007 (UTC)Reply

exchange for in loops for prototype.js compat.

[edit]

if you exchange all for ( m in n ) with for (m = 0; m < n.length; m++) in EditorsMap.js the mapeditor will work if prototype.js is loaded. Marius

Good catch, Marius. I'll fix this in the next version. --Emiller 07:00, 18 January 2007 (UTC)Reply

OpenStreetMap

[edit]

Hi Evan! can you write a such extension also for OpenStreetMap? That would be great!
I would like to use it in Wikipedia and in our City-Wiki... Thanks, --Markus Bärlocher 23:24, 10 March 2009 (UTC)Reply

why dump only attributes which differ from default ?

[edit]
dumpMapAttributes: function() {
// but only those which differ from defaults

I really can’t understand why this behavior. If after some time using this extension, I wish to change some default settings. For instance I wish to use now terrain as default map because it is the most used, then all the map already created will change to terrain. It is not expected.

I have modified the code for my wiki http://www.brunehaud.be/Brunehaud.be:Google_Maps

Jean-Louis Hens 08:42, 8 July 2009 (UTC)Reply