GMap-Talk

Summary: Talk Page for GMap recipe
Maintainer: Petko

Your comments are welcome. Please post new comments below this line.


To open Google Earth Pro Tours in PmWiki
This is a very important skill because a number of tours and sub-tours can be organized on a PmWiki page.
In Google Earth Pro:
1. Open a blank tour format using Add, or the record a tour button on the toolbar.
2. Record your tour by hitting the red button and then stop the tour by hitting it, again.
3. Stop the looping that follows by hitting the stop button at the head of the tour operating bar.
4. Right click the print button on the tour operating bar, and choose a name you want to use for this tour in the window that pops up.
5. That name will appear on the left-hand panel in the Temporary Places folder. There will be a little movie camera sign to show its a tour and not something else that you can save in Temporary Places.
6. Right click this and choose Save to My Places in the pop-up menu. This will make the icon appear above in My Places.
7. Now, you can right click it again, and choose Save Place As. Choose Desktop, and from there you can upload to PmWiki if you have added KMZ to your list of uploadable file types in your config file. I do this by using the size line in the the Uploads config. $UploadExtSize['kmz' ] = $aSize;

Conclusion: When you click on the link in PmWiki, it will open Google Earth Pro by default and play.

Endpost

This module is marked as (uncertain) and I don't think it still works.

I have obtained a Google Maps Javascript API that appears to be functioning. (I tested that Google Maps API Key by restricting the domain which caused an error in the embedded map in PMWiki and then removing the domain restrictions that did display a map in PMWiki.) The Google Maps page has also changed, on the Top-Left, under the hamburger menu, the options share link | embed map are applicable which means the instructions on the GMap page should be amended. Obviously embedding the map is the wrong option. Since maps.google.com seems to be inactive and redirects the user to a localised page including language options, the option of creating a link to a Google Map no longer works as in [[ https://www.google.co.za/maps/@51.7529414,-1.2576448,16.25z?hl=en | Link to my map ]] . Changing the URL to start with http://maps.google.com/ does not work either.

The embedded map option [[ GMap:ll=48.853213,2.349116&z=15 | MyMap ]] does display an interactive map, but regardless of the co-ordinates I change this to, the map is always centered in the ocean below West Africa at latitude 0 and longitude 0. The test urls were,

[[ GMap:=-27.6709942,27.2345927 | Kroonstad ]]

[[ GMap:=51.7529414,-1.2576448 | Oxford UK ]]

Also worth noting is that the zoom paramaters on Google maps seem to have changed and is no longer part of the URL after the question mark. ( <Google Maps URL followed by latitude,longitude>,16.25z?hl=en )

The conclusion is that this plugin is no longer functioning, and since the Ape plugin does not appear to support embedded Google Maps and the Google Map API is also flagged as not working, PMWiki may effectively be without support for Google Maps.

My guess would be that the javascript code that interacts with GMap will have to be amended probably due to some API changes by Google, though I am at work now and will only look at it much later tonight.

casperl

Thanks for testing it out. Ape can embed Google custom maps which you edit on Google and embed in your wiki. Otherwise use Ape with OpenStreetMap. --Petko January 24, 2018, at 09:49 AM

25/1 - 12:31 Hi Petko, thanks for your reply. I will take another look at Ape, which I could not get working with GMaps yesterday. There was something, somewhere about GMaps having too many elements for Ape to handle, but I will investigate again and provide feedback.

I looked at the code for GMaps and it is a very large Javascript file trying to do a whole lot of things. That GMaps code was originally based on an old Wordpress plugin, which opens the possibility that there might be a drop in-replacement of updated and working code that can be adapted. The DokuWIki GMaps plugin has a codebase that is so old that it probably has the same issues PMWiki has, ;-D . On GetSimple CMS there is a GMaps plugin that embeds a Google Map based on latitude and longitude. The Javascript code is a small file, self explanatory and it appears clear enough to adapt. At some future point I will try to get that to work in PMWiki.

After years of suffering through the plugin hell of the Drupal environment, my philosophy is that any plugin should perform a single function, but to do it well. That does not mean that there is no place for implementing features of the GMaps API, but that should be a separate extension offering either a container/placeholder, or an API in which manipulate maps. - casperl

The current solution is to log into your Google Maps console, create a new "public" map with all the bells and whistles, markers, icons, directions, then embed this public map into your page with Ape -- should be good enough. This is really less painful than editing a wiki-definition-list with coordinates in a wikitext page. For a map with a single pin this is too much work, use OpenStreetMaps instead. For a multiple-features map create one either at Google Maps, or at uMap.OpenStreetMap.fr then place the share link into the page so Ape can embed it. If this is not enough, and you have the time to write a new GMaps-only plugin and to support it, please do. Sorry I relied on a vendor, and they broke their public API, and people trusted them. --Petko January 25, 2018, at 06:47 AM


Hi Petko, firstly, thank you for your sterling work with PMWiki and this module. Hardly a day goes by where PM-Wiki does not amaze me in some new way.

For the benefit of other users, copying the line "$GMap['Key'] = "ABQIAAAA...GWA"; # your own key" from the GMap Cookbook page and then using the clipboard to paste that line into the local/config.php (I used VIM) will cause a &nbsp; to be added before #your own key.

   $GMap['Key'] = "ABQIAAAA...GWA"&nbsp;# your own key 

Deleting that &nbsp; will also delete the semicolon at the end the line of PHP which in turn will give you a blank screen in your browser instead of a PMWiki page.

Hopefully this will save someone else the "sudden moment of mortal shock" that I experienced when all my hard work changed into a blank page.

casperl

Thank you for mentioning this: I had not experienced it (I copy and paste the other way around: from config.php to the wiki ;-). I've now moved the comment on the previous line. --Petko January 24, 2018, at 05:05 AM


Hi Petko. I'm having trouble with maps that don't have a specific ll=.... For instance, i have a map that is for a town/zipcode:

... and when GMap replaces the code, it returns nothing but the zoom factor: [[GMap:z=13]]

in addition, i have a personal google map:

... and when GMap replaces the code, it again returns something that breaks:

[[GMap:z=8&msid=101715684446875238333.00044f1ded6e791d7c5ad]]

is there a way to embed these kinds of maps with GMap? and a way for the ROEPattterns to successfully convert them from their natural http://maps.google... state?

overtones99 October 18, 2009, at 07:55 PM

With both locations, if you just move the map a little, or zoom in-out, then the links will obtain a ll= parameter and the GMap should display fine. The latest version 20091022 will use an existing sll= parameter if the link doesn't have the required ll= parameter. About the personal multimap (the first one I see!), there are two problems: without the ll= parameter it doesn't work, but with it, it displays an additional red pin on that location. I'll try to fix it as soon as possible. (Should be fixed from 20091025.) --Petko October 21, 2009, at 06:18 PM

hi petko thanks for your work on the gmap recipe. it's fun to play with! and thanks for addressing my recent questions.

here are some more comments and questions:

  • your suggestions (& the new recipe) worked - thanks!
  • i see what you're talking about with the extra center pin showing up on personal maps. i look forward to that disappearing : )
Until I fix this, you can remove the center pin by adding a "nomarker" title, like GMap:ll=...&msid=..."nomarker". You still need the ll= parameter though. Should work from version 20091025.
  • it took me awhile to figure it out, but these maps are very persnickety, and can malfunction very easily when other maps are on the same wikipage - i.e. an error in one very often short-circuits the rest. for instance i fiddled with the personal multimap for over an hour (which wasn't working), and it didn't start to work until i finally removed other test maps from the page. i don't know what changed, or what the situation was, but i had run into a similar problem a couple days before, and thought i had "solved" the earlier problem and could continue working simultaneously with these test maps. i wonder if you've run into the same problems? if so, perhaps the recipe page could use a note suggesting only working on one map at a time to prevent problems?
The recipe should work with more than one map in a page, and an error in one shouldn't break the others. There shouldn't even be "an error in one", errors should be prevented -- if you have maps with errors, please show them to me, or better, add them to my sandbox for investigation.
  • for some reason the current method of designating a list of points with %gmap% took a long time to click for me, and i foresee users of gmap on my site(s) probably running into the same problem. i wonder if it's possible to instead wrap the pins in a >>gmap<< instead? so, instead of:
     : %gmap% GMap:ll=33.966142,-117.965698&z=8 : center & zoom of entire map
     : GMap:ll=34.170038,-118.047581&z=16 : # 1
     : GMap:ll=34.187613,-118.131244&z=16 : # 2
maybe something like this:
     >>gmap<
     : GMap:ll=33.966142,-117.965698&z=8 : center & zoom of entire map
     : GMap:ll=34.170038,-118.047581&z=16 : # 1
     : GMap:ll=34.187613,-118.131244&z=16 : # 2
     >><<
... not sure if this is possible, but it just visually makes more sense to me when i'm starting out from scratch...
This is currently not possible without complexifying the code too much.
  • with the following map (for the white house), is it possible to automatically display the google-pin-info without having to type it in? for instance, the pin on google reads:
	White House
	1600 Pennsylvania Ave NW
	Washington, DC 20500-0004
	(202) 456-1414
	whitehouse.gov
is it possible to get this google pin info to display automatically?
No, this is not possible. Couldn't you just copy and paste the text you want?
of course, but it'd be amazing to be able to tap that wealth of info (which might update over time) that's already sitting there, whether placed by businesses or by users. it would prevent unnecessary typing, and also allow for info that is updated or added to predefined points. is this a limitation of google, or of this recipe?
The recipe does nothing specific to "limit" this, you are asking for a new, nonexistent feature. At the moment, I have no time to research if it is possible, to work on implementing it, and to support it. GMap is not meant to support all possible features, maybe GoogleMapAPI could suit you better?
  • and finally, i know this may be like asking for too many bells and whistles, but i'm just thinking ahead to user-questions/frustration on my pages - i wonder if the ROEPattern could somehow detect that someone's adding a pin to a map, and then provide the :list:definition: markup instead? (sorry if this is too much to ask for!)
so that:
     : %gmap%GMap:ll=33.966142,-117.965698&z=8 : center & zoom of entire map
     : GMap:ll=34.170038,-118.047581&z=16 : # 1
     : GMap:ll=34.187613,-118.131244&z=16 : # 2
     http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=
     &q=the+white+house&sll=34.140083,-118.214264&sspn=0.07175,0.133381&ie=UTF8
     &hq=The+White+House&hnear=The+White+House,+Washington,+DC&ll=38.904459,-77.036562
     &spn=0.032061,0.06669&z=14&iwloc=A
turns into:
     : %gmap%GMap:ll=33.966142,-117.965698&z=8 : center & zoom of entire map
     : GMap:ll=34.170038,-118.047581&z=16 : # 1
     : GMap:ll=34.187613,-118.131244&z=16 : # 2
     : GMap:ll=38.904459,-77.036562&z=14 : #3
No, because an author may actually want to add a second map in the page. I use the Preview button a lot, so I can see if the page is or isn't like I want. --Petko October 24, 2009, at 04:18 AM
but i wonder, if you're creating a 2nd map on the page, there are usually 2 indicators that previous maps are done: 1) newline(s), and 2a) the %gmap% located in the first line or 2b) a bare Gmap: indicator. seems like there could be a simple ROE rule to differentiate. maybe i'll look into it...
Please do. You can add your own $ROEPatterns in config.php.
btw, my concerns about these are based on the non-wiki users that frequent my sites. most are happy to try things out, but aren't interested in spending a couple hours figuring things out like i did last night. they also don't ask questions when they run into problems - they stop. so my personal style is to try and make it even simpler on the surface (which may lead to more complexity underneath). just wondering aloud if there are some ways to make this even more intuitive... thanks overtones99 October 24, 2009, at 02:29 PM
If the instructions ("go to [3], find your location... zoom in and double click... copy the link") were so unclear that you spent hours to make it work, then the recipe or the docs need fixing. :-)
obviously that was the cinchy part. it was everything after that, with maps malfunctioning that was cause for consternation... (plus experimenting to try and see if one could get google info to pop up)... i'll look to see if i can reproduce the more random errors...
I didn't know about the personal multimaps, I'll try to find some time to implement this feature correctly, but that's about all my plans. Non-wiki users unwilling to read a paragraph of the documentation are not the intended audience of this recipe.
i realized while driving home that i might try my hand at writing some FoxForms & FoxFilters to enable non-wiki addition and editing of points. might work very nicely, keeping extra clutter out of the recipe. if i do, i'll add some documentation here.
Note that you may be able to show whatever the map displays on Google with the second link starting with <iframe -- see the EnableHTML, IncludeUrl and IncludeSite recipes. And again, the GoogleMapsAPI recipe has probably all the features a person may need. --Petko October 24, 2009, at 05:00 PM

thanks petko! overtones99 October 24, 2009, at 10:19 PM

Hi, I wanted KML support. KML lets you add information to maps, like curves. It turns out KML support is in the javascript, it just needs enabling with markup.

I added these lines to cookbook/gmap.php

$LinkFunctions['GMapKML:'] = 'LinkIMap'; $IMap['GMapKML:'] = '$1'; $IMapLinkFmt['GMapKML:'] = "<a class='gmaplink' title='kml' href='\$LinkUrl' rel='nofollow'>\$LinkText</a>";

after the ones that set up the GMap markup.

Then in my wiki page I can have:

: %gmap% GMap:ll=54.454073,-3.015747&z=9 : center & zoom of entire map
: GMapKML:http://www.pacificbulbsociety.org/pbswiki/maps/lakes.kml :

where the second line contains the URL of my KML file and adds it to the map.

HTH, David Pilling


Talk page for the GMap recipe (users?).