HorsePunchKid,
I'm interested! When you get a chance please do post your module here.
TIA
HorsePunchKid
Joined: 2005-05-04
Posts: 89
Posted: Sun, 2005-09-25 01:07
Thanks for the tip, valiant. I've done that and generally tried to clean things up a bit in my code. There is a simple admin interface that gives you control over some very basic parameters (e.g. map size, whether or not to display summaries, etc.). It seems to be working fairly well. If you'd like to try it out, you can get it here. Please read the included README file!
samkuhn2: Sounds like a good idea, but I do not have the time to devote to it at the moment.
-- http://severinghaus.org/gallery/
f33dback
Joined: 2005-07-06
Posts: 21
Posted: Tue, 2005-09-27 16:37
I am very interested in this feature because I have set this up for my local community college (student assistant/slave) however while I got it to work as a theme it was to complex for the users so I removed it, if anyone can make this as easy to use as the other modules that would be the bee's knee's.
RwD
Joined: 2005-01-09
Posts: 383
Posted: Tue, 2005-09-27 17:55
This isn't really a theme, is it? Could this not be rewritten so it can be plugged into any gallery, regardless of the theme? I mean all I see here is the Matrix theme with the google map thing inside...
Sorry, I see HorsePunchKid already mentioned it and made it into a module...
Shocksll seems to suggest that the entire thing has not yet been put into a module, should it not? (see post below)
______________________
I made a theme for G2, try it
shocksll
Joined: 2005-06-22
Posts: 352
Posted: Tue, 2005-09-27 21:35
From what I've figured out is all the module does it help the setup for the theme. The theme needs you to create a custom field for all albums that use the map to hold the google map API id. You still have to use the map theme to display the images.
Steve Lineberry
HorsePunchKid
Joined: 2005-05-04
Posts: 89
Posted: Tue, 2005-09-27 22:31
The way I set things up when I converted it to a module is fairly basic. I don't have a fresh install to try it out on, but all you should need to do is:
Back up your files and database! I haven't had any problems at all, but I can't ask you to trust my code.
Unzip this module and put the "map" directory into your "gallery2/modules/" directory.
Go to your Site Admin page and install and activate the Map module.
Go to "Map" under the Site Admin menu and enter your API key; configure other parameters as you see fit.
Enable the "custom fields" module and create a "common field" called "GPS" (you may want to restrict this to just albums; the map module doesn't care).
Enter GPS coordinates for items; I believe they're in "Longitude,Latitude" format, for example roughly "-87.6244160,41.8806700" for Chicago, IL.
The URL to access you map is http://yoursite/gallery2/main.php?g2_view=map.ShowMap, though it's easy enough to put a redirect in for it, as I have. I can detail that in another post if there is interest in it.
I've updated the googlemaps theme code a little bit.
My changes include:
1. Fixing the Internet Explorer problem as defined here http://andrew.sterling.hanenkamp.com/node/119
2. Changing the GoogleMapKey from a custom field to a theme setting.
3. Fixed the theme's description
Steve Lineberry
shocksll
Joined: 2005-06-22
Posts: 352
Posted: Wed, 2005-09-28 17:01
Ok, i've updated the map theme again.
Changes mainly include the popup box formatting:
1. Checkboxes in theme settings for whether to display summaries and/or descriptions
2. It now says Image or Album depending on item instead of always displaying image
3. It says Date on the next line instead of "was taken on"
4. All popup box contents are centered.
Steve Lineberry
shocksll
Joined: 2005-06-22
Posts: 352
Posted: Wed, 2005-09-28 17:03
I've also updated the map module
The changes are:
1. Now checks whether summary and description is empty before outputting the text
2. Fixed the Internet Explorer problem as defined here http://andrew.sterling.hanenkamp.com/node/119
3. All popup box contents are centered
Steve Lineberry
gilrim
Joined: 2005-08-28
Posts: 32
Posted: Wed, 2005-09-28 17:17
dunno if it's anything I'm doing wrong here, but upon saving the config in the administration panel, g2 gives me this:
Warning: Cannot modify header information - headers already sent by (output started at /var/www/php_libs/gallery2/modules/map/MapSiteAdmin.inc:123) in /var/www/php_libs/gallery2/modules/core/classes/GalleryPhpVm.class on line 124
the settings are saved, nevertheless, so it's more of an annoyance than anything else..
(on another note, I'll try to hack together a way of linking to the map from the front page)
shocksll
Joined: 2005-06-22
Posts: 352
Posted: Wed, 2005-09-28 17:48
There is some extra space and/or carrage return at the end of that file after the ?>
Delete everything after the ?> and that should fix the problem.
Steve Lineberry
billimek
Joined: 2005-04-13
Posts: 10
Posted: Wed, 2005-09-28 20:36
I was working on getting the module code modified to work in IE and I was going to post it, but shocksll beat me to the punch. I have, however, modified it slightly to expand the width of the map to fit the browser window. I had a really tough time trying to figure out how to make it auto-reszie for the height of the browser. If anyone knows how to accomplish this (for both firefox and IE) please let me know.
p.s. This is the .htaccess recipe I used to allow for the nicer URL:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /jeff/gallery/
RewriteRule ^map(/)? main.php?g2_view=map:ShowMap
</IfModule>
Thanks,
Jeff
swordfish
Joined: 2004-10-01
Posts: 388
Posted: Thu, 2005-09-29 01:22
shocksll,
Cool! Your efforts are appreciated, thanks for sharing. Downloading these two zip files using IE6 and both are corrupt. Downloading them using FF and no problems. Another IE bug! M$ never ceases to amaze me on the shit they dump out to the world. They both have constant security vulnerabilities but FF 'works' much better.
shocksll
Joined: 2005-06-22
Posts: 352
Posted: Thu, 2005-09-29 03:12
Thanks. Here's a new version.
This one you can now set the following defaults in the theme settings:
1. Center GPS position
2. Zoom level
3. Map Type (map, satellite, hybrid)
Steve Lineberry
swordfish
Joined: 2004-10-01
Posts: 388
Posted: Thu, 2005-09-29 03:57
Awesome!
HorsePunchKid
Joined: 2005-05-04
Posts: 89
Posted: Thu, 2005-09-29 07:49
Trying to keep up with things here! I've added shocksll's improvements to the module version and figured out how to get the Javascript into the footer ({g->addToTrailer}), which is what keeps IE from choking. You can see it in action here (don't worry; that paragraph above the map is in my "local" directory, which I have not included), and you can download the module here. (I'll also try to attach the zip file here.)
billimek, that's basically what my rewrite was, only I had to make sure that it occurred before the other rewrites so that G2 would not try to find an album called "map".
Thanks HorsePunchKid. One suggestion, you probably want to increment the module version whenever you make a change. I incremented it to 0.1.1 when I did my changes and since yours is still at 0.1, anyone that is currently using mine will not be able to upgrade to yours. Can you redistribute yours as 0.1.2? Thanks for your hard work.
Steve Lineberry
shocksll
Joined: 2005-06-22
Posts: 352
Posted: Thu, 2005-09-29 11:39
Also, can you please remove the extra carrage return or linefeed at the end of MapSiteAdmin.inc
That causes some of us when we save the settings to get a blank page or error. Thanks.
Steve Lineberry
HorsePunchKid
Joined: 2005-05-04
Posts: 89
Posted: Thu, 2005-09-29 22:08
shocksll: Done and done. The new code is here or attached to this post. I changed the zip filename to reflect the actual version.
One thing that is probably not working properly still is the item descriptions. I have some descriptions that are a couple of paragraphs long with embedded HTML, and they do not seem to fit into the Javascript context properly. I don't know enough about Smarty's output filters ("modifiers"), and I'm also not quite sure where the Javascript is breaking syntactically.
Sweet, thanks man. Can you post a link to a map page where you have the long descriptions and I can take a look. Thanks.
Steve Lineberry
swordfish
Joined: 2004-10-01
Posts: 388
Posted: Fri, 2005-09-30 03:17
ok, finally took the time to install/configure and believe I have most of it working.
This is so damn cool!
I installed map-module-0.1.2.zip and map-theme-1.0.2.zip.
My problem is that when going to the url I get this ugly error message saying, "The Google Maps API key used on this web site was registered for a different site web site".
I tried punching in multiple urls to my album directory with no luck.
The url I'm using now to get the API key is http://my.site.com/v/TravelMap/.
Using G2 1.0 embedded in WP 1.5.2 with WPG2 plugin and URL rewrite.
After clicking ok on the error message my Map displays along with the pushpins, and bottom row of thumbnails. Same behavior under Firefox.
Any ideas what I might have done wrong?
HorsePunchKid
Joined: 2005-05-04
Posts: 89
Posted: Fri, 2005-09-30 03:25
I'd send a link, but somehow it started working correctly, though I don't think the changes I made (see the diff) were responsible. I should try to write a description or summary that has particularly nasty characters in it and see what happens.
After running some experiments in trying to eliminate this API key error alert in which for some cases the error does not occur for me, I've concluded that it's an issue with Google's API and mod_rewrite. It appears to be a question asked daily on Google's API forum in which many folks are experiencing same or similar issues. And since WPG2 is no longer supporting G2 url rewrite think I'll just ignore this error until Google updates their API or someone here comes up with a fix or workaround.
I've spent 3+ hours on this so perhaps tomorrow the error will disappear.
Kudos to all you guys who have done a great job with this module and map theme!
HorsePunchKid
Joined: 2005-05-04
Posts: 89
Posted: Fri, 2005-09-30 07:40
For what it's worth, swordfish, when I got my API key, I just asked for the root of my website instead of the directory that the map lives in. I could definitely picture problems if you've registered for "foo.com/bar/map" and you're trying to rewrite the URL to "foo.com/bar/main.php?show=map" (roughly speaking, of course).
Has anyone else experience this error on their map page: Warning: assert(): Assertion "!empty($ids)" failed in /var/www/gallery2/modules/core/classes/GalleryStorage/DatabaseStorage.class on line 2059
a little check with phpmyadmin reports this:
Problems with indexes of table `g2_AccessMap`
Warning UNIQUE and INDEX keys should not both be set for column `g_accessListId`
Problems with indexes of table `g2_PluginParameterMap`
Warning UNIQUE and INDEX keys should not both be set for column `g_pluginType`
Warning More than one INDEX key was created for column `g_pluginType`
**FIXED** Didn't have any GPS data appended to any items...Durr
shocksll
Joined: 2005-06-22
Posts: 352
Posted: Sat, 2005-10-01 01:48
Does this only happen when you have the theme or module enabled?
Steve Lineberry
DDM
Joined: 2005-09-30
Posts: 7
Posted: Sat, 2005-10-01 01:56
Yeah both are enabled. It happens when I try to go to "main.php?g2_view=map:ShowMap" which is rewritten to gallery2/map/ so when they're disabled I just get a good ol' permission denied error.
Thanks for your help btw.
swordfish
Joined: 2004-10-01
Posts: 388
Posted: Sat, 2005-10-01 04:27
Think I found bug with the map theme, map module, or combination of both.
The API key text block in the map theme by default is checked (Use global).
I inserted my API key in the map module form.
Goto my website and I get the Map API alert (twice) and the map never loads.
Viewing the page source and the map API key= is blank!
If I insert the same API key in the map theme API block then the Google map loads.
I still get the API key alert (only once though and yes I did try multiple urls including the root directory) but at least it loads and is functional.
If I leave the API key in the map theme and then change the API key in the map module form to something else then the API key in the map theme is taken and the API key inserted in the map module is ignored. Think this part is correct since the Global default is now unchecked and if leaving the MAP key blank in the module the map still loads.
I did ensure I cleared all cached/template files after each map key change.
So is this a bug?
samkuhn2
Joined: 2004-04-13
Posts: 60
Posted: Sat, 2005-10-01 22:33
I made a set of google png push pins based that match the "Web Hues" swatch pallete in Photoshop CS. I thought they might be useful for this theme so that different albums could have different colors. The individual files are not available for direct linking, but you can download the zip file or look at the contact sheet here: http://people.vanderbilt.edu/~sam.kuhn/gmaps/index.html . The file exceed the max file size for the forum, so you'll have to get it from my web space.
A better way to do this is probably just to use ImageMagick's ModulateImage command to adjust the hue on a stock pushpin, but I don't know how to do that, so I made pngs. http://www.imagemagick.org/api/enhance.php.
swordfish
Joined: 2004-10-01
Posts: 388
Posted: Sun, 2005-10-02 00:44
billimek,
I'm looking at your map and trying to figure out how you linked all your pushpins to the various albums you have. I'm obviously missing a few steps and have not grasped the concept of this mapping. Other than the map album I created the rest of my G2 uses Matrix theme. Appreciate any hints.
Thanks!
shocksll
Joined: 2005-06-22
Posts: 352
Posted: Sun, 2005-10-02 02:19
You need to create a custom field called GPS and enter the GPS coordinates in that field for each item in the form long, lat
Steve Lineberry
HorsePunchKid
Joined: 2005-05-04
Posts: 89
Posted: Sun, 2005-10-02 03:31
swordfish: For what it's worth, I found these two sites very useful for finding the latitude and longitude of the cities I've taken photos in. Just note that they give you (latitude,longitude) when you need (longitude,latitude) for Google Maps (see here).
swordfish: For what it's worth, I found these two sites very useful for finding the latitude and longitude of the cities I've taken photos in. Just note that they give you (latitude,longitude) when you need (longitude,latitude) for Google Maps (see here).
http://www.robogeo.com/latlonfinder/map.asp is another useful location->lat/long page. Double click on your location and then just cut and paste the values (and reorder, of course). This type of tool might even be a useful element of a fully-featured GPS system in Gallery2.
DDM
Joined: 2005-09-30
Posts: 7
Posted: Sun, 2005-10-02 17:05
Thanks for the help, that error is gone now. Going to the map page now brings up a blank window, debugging didn't reveal any obvious problems.
It just looks like a normal gallery page with the words "Photo Map" and that's it.
Another question: Now that I can include the google key in the admin page for the module, do I still need the custom field? When I registered for the google API I registered it to http://mysite/gallery2 rather than a specific folder within the site, could this be the cause?
HorsePunchKid
Joined: 2005-05-04
Posts: 89
Posted: Sun, 2005-10-02 18:50
When I see the page come up blank, as you described, I first check the source for the page. Sometimes you can manually spot errors in the generated Javascript better than by using a debugger. Do you have GPS coordinates in for at least one album or photo? I haven't actually tested it when you don't have any, though I can't really think of any specific reason it would fail in that case.
If you're using the module, you don't need the custom field for the API key. All you need is the GPS field.
I don't think the URL you registered your key for would be causing this problem. When Google has a problem with your key, you get a very obvious Javascript alert box telling you there's a problem.
shocksll
Joined: 2005-06-22
Posts: 352
Posted: Sun, 2005-10-02 18:54
If you are using the theme version 1.0.0 or higher you don't need the custom field for the api key.
Steve Lineberry
DDM
Joined: 2005-09-30
Posts: 7
Posted: Sun, 2005-10-02 21:22
Yeah, having no GPS coordinates gave me the initial DatabaseStorage.class error, that's fixed. I checked the source yesterday and saw no issues. It even correctly identified the 6 or so items I labeled with GPs coords.
And you were right, it isn't an issue with the API code, once I deliberately changed the key, I saw that error.
Thanks for your help so far people.
obere
Joined: 2003-10-12
Posts: 14
Posted: Mon, 2005-10-03 14:07
What about creating an image block version of the map module too? Of course it would have to be relatively small (like 150px wide) but it would be nice if, for example, in an album of pictures from a trip to Japan to have a little mini-map on the left pointing out Kyoto in a sub-album of Kyoto pictures.
There were quite a few discussions on the GoogleMaps-API group about maps only showing markers at a certain degree of magnification too. This could work to help maintain only one map for all galleries but show different markers based on the center and magnification of the mini map.
samkuhn2
Joined: 2004-04-13
Posts: 60
Posted: Mon, 2005-10-03 15:43
Another site that uses gmaps to determine lat/long. The code looks very simple; I'm sure it would be easy to pipe the lat/long into the appropriate custom field in Gallery. Maybe something like this, but it would have an "OK" box in the popup of lat/long to allow you to confirm that it is the right location. Of course, the map also needs zoom control, and maybe a search box to allow gross localization (say "Chicago, IL", then you can manually zoom in on the corner of 34th and Elm,etc). http://conversationswithmyself.com/googleMapDemo.html
mjhughes
Joined: 2005-06-08
Posts: 5
Posted: Mon, 2005-10-03 22:24
Hi all ... loving this thread, got me really excited and I'm trying to install now for my gallery but boo hoo ... my ISP (great as they are) uses Microsoft Server so I'm having trouble figuring out how I get a nice friendly directory to feed the Google API Key generator ... I assume I can't use the ugly URL that Gallery2 is making? Or is this just impossible with IIS? (Please ... I hope not!)
Cheers
Mike
P.S. Ok so there is ISAPI_rewrite for IIS ... but I saw the post http://gallery.menalto.com/node/32793 and there was no conclusion whether this works or not ... anyone know if G2 can do URL re-writes with ISAPI_rewrite on M$ IIS? Ah ... hang on now I just found this too ... http://gallery.menalto.com/node/11275 ... lesson here is always search the forums for the answer before posting!
If anyone has some free time, I'd appreciate any help regarding my annoying problem. Attached is the source to my map page, and if anyone can see something wrong with it, please let me know.
Thanks
***FIXED*** Ah nevermind, My Map theme was in the wrong place due to carelessness. Thanks
File removed
And yes, I have the same API issue as the poster below me.
Error: "The Google Maps API key used on this web site was registered for a different web site. You can generate a new key for this web site at http://www.google.com/apis/maps/." but on clicking OK the page loads OK anyway!
... strangley if I check he show descriptions box it fails totally and I just get the error box and a blank page when I check OK. Also, either way I am unable to set a highlight for the album Travel Places ... is this possible even though it has the map theme?
must go to bed ... zzzzzzz
Mike
swordfish
Joined: 2004-10-01
Posts: 388
Posted: Tue, 2005-10-04 01:53
Hi all,
Thanks for the tips/links on Lat/long. Now I have new problem.
I've spent untold hours getting the Google map to function and format to my WordPress/G2 site with url_rewrite. First the issue with the damn API key, then url_rewrite, formatting issues, then css hacking and list goes on. Anyways just when I got it all working (viewing under Firefox) I checked with IE6 and when the map went to load I get this infamous error, "Operation Aborted" and get dropped out to page cannot be displayed. Jeez, you've got to be kidding me!! Searching through Google's API forum I see alot of people have the same issue. I tried modifying the map theme (theme.tpl) to have the javascript code in the <head> section along with a <body onload="mapload();"> but so far no luck. Still works fine in Firefox though. It seems IE either has a bug or the Map theme does not conform to standards; I'm not sure and certainly not blaming anyone here. See Operation Aborted.
I'm also not sure if this error is somehow due to my G2 embedded under WP. So close yet so far, argh! shocksll, Could you please help me out?
intrinsic
Joined: 2005-09-24
Posts: 2
Posted: Tue, 2005-10-04 08:54
i'v had the same prob.
Put your google javascript in a function. Call this function just below it self with window.onload = googlemap;
like:
<div style="border: 1px solid rgb(0, 0, 0); width: 500px; height: 400px;" id="map"></div>
<script type="text/javascript">
//<![CDATA[
function googlemap(){
if (GBrowserIsCompatible()) {
var map = new GMap(document.getElementById("map"));
map.centerAndZoom(new GPoint(8.844938278198242, 47.54663986006874), 13);
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.addControl(new GScaleControl());
var marker = new GMarker(new GPoint(8.844938278198242, 47.54663986006874));
map.addOverlay(marker);
var html = "your text <br /> blablbabla ";
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(html);
});
}
}
window.onload = googlemap;
//]]>
</script>
may it helps!!
regards roman
swordfish
Joined: 2004-10-01
Posts: 388
Posted: Wed, 2005-10-05 03:27
intrinsic
Thanks for the help but unfortunately did not help. No matter what I try IE always loads the map but then get the Operation Aborted crap. Think my problem is...
1) Where exactly should I put this Google javascript since I'm using the Map module and the Map theme?
2) I've tried modifying the map theme (theme.tpl) and even placing the Google javascript in my WP header file but still get same error.
3) Using a function to call the Google map seems to work for everybody but me.
4) I've tried so many options I now need to start all over again.
5) I've read the IE problem as described here but yet still can't get it to work. I feel totally hopeless.
swordfish: This won't be fun, but one last resort technique for debugging stubborn code like this (when you don't have a stepper) is to just put a "print" statement between every line of code. Print out a different value at each step, and you'll be able to see what step it's throwing that error on: the one right after the last successful print statement. I think the closest analog to "print" in Javascript is probably alert(); I'm not sure that document.write() or whatever would be very reliable.
For what it's worth, I had all sorts of problems in IE until I realized that for no apparent reason, the Javascript has to go at the very end of the document. Note how in my map, the script isn't inside any div at all. I think that's something you should try. Get that Javascript down outside of the divs, right next to the closing body tag, if possible.
FYI, if you have any type of quotes in your albums title or comments you will get an error. I just spent the last 2 hours of my life trying to figure this out!
Posts: 388
HorsePunchKid,
I'm interested! When you get a chance please do post your module here.
TIA
Posts: 89
Thanks for the tip, valiant. I've done that and generally tried to clean things up a bit in my code. There is a simple admin interface that gives you control over some very basic parameters (e.g. map size, whether or not to display summaries, etc.). It seems to be working fairly well. If you'd like to try it out, you can get it here. Please read the included README file!
samkuhn2: Sounds like a good idea, but I do not have the time to devote to it at the moment.
--
http://severinghaus.org/gallery/
Posts: 21
I am very interested in this feature because I have set this up for my local community college (student assistant/slave) however while I got it to work as a theme it was to complex for the users so I removed it, if anyone can make this as easy to use as the other modules that would be the bee's knee's.
Posts: 383
This isn't really a theme, is it? Could this not be rewritten so it can be plugged into any gallery, regardless of the theme?
I mean all I see here is the Matrix theme with the google map thing inside...
Sorry, I see HorsePunchKid already mentioned it and made it into a module...
Shocksll seems to suggest that the entire thing has not yet been put into a module, should it not? (see post below)
______________________
I made a theme for G2, try it
Posts: 352
From what I've figured out is all the module does it help the setup for the theme. The theme needs you to create a custom field for all albums that use the map to hold the google map API id. You still have to use the map theme to display the images.
Steve Lineberry
Posts: 89
The way I set things up when I converted it to a module is fairly basic. I don't have a fresh install to try it out on, but all you should need to do is:
The URL to access you map is http://yoursite/gallery2/main.php?g2_view=map.ShowMap, though it's easy enough to put a redirect in for it, as I have. I can detail that in another post if there is interest in it.
--
http://severinghaus.org/gallery/
Posts: 352
I've updated the googlemaps theme code a little bit.
My changes include:
1. Fixing the Internet Explorer problem as defined here http://andrew.sterling.hanenkamp.com/node/119
2. Changing the GoogleMapKey from a custom field to a theme setting.
3. Fixed the theme's description
Steve Lineberry
Posts: 352
Ok, i've updated the map theme again.
Changes mainly include the popup box formatting:
1. Checkboxes in theme settings for whether to display summaries and/or descriptions
2. It now says Image or Album depending on item instead of always displaying image
3. It says Date on the next line instead of "was taken on"
4. All popup box contents are centered.
Steve Lineberry
Posts: 352
I've also updated the map module
The changes are:
1. Now checks whether summary and description is empty before outputting the text
2. Fixed the Internet Explorer problem as defined here http://andrew.sterling.hanenkamp.com/node/119
3. All popup box contents are centered
Steve Lineberry
Posts: 32
dunno if it's anything I'm doing wrong here, but upon saving the config in the administration panel, g2 gives me this:
Warning: Cannot modify header information - headers already sent by (output started at /var/www/php_libs/gallery2/modules/map/MapSiteAdmin.inc:123) in /var/www/php_libs/gallery2/modules/core/classes/GalleryPhpVm.class on line 124
the settings are saved, nevertheless, so it's more of an annoyance than anything else..
(on another note, I'll try to hack together a way of linking to the map from the front page)
Posts: 352
There is some extra space and/or carrage return at the end of that file after the ?>
Delete everything after the ?> and that should fix the problem.
Steve Lineberry
Posts: 10
I was working on getting the module code modified to work in IE and I was going to post it, but shocksll beat me to the punch. I have, however, modified it slightly to expand the width of the map to fit the browser window. I had a really tough time trying to figure out how to make it auto-reszie for the height of the browser. If anyone knows how to accomplish this (for both firefox and IE) please let me know.
If you want to see another sample gallery using the map integration you can go to: http://billimek.com/jeff/gallery/map/
p.s. This is the .htaccess recipe I used to allow for the nicer URL:
Thanks,
Jeff
Posts: 388
shocksll,
Cool! Your efforts are appreciated, thanks for sharing. Downloading these two zip files using IE6 and both are corrupt. Downloading them using FF and no problems. Another IE bug! M$ never ceases to amaze me on the shit they dump out to the world. They both have constant security vulnerabilities but FF 'works' much better.
Posts: 352
Thanks. Here's a new version.
This one you can now set the following defaults in the theme settings:
1. Center GPS position
2. Zoom level
3. Map Type (map, satellite, hybrid)
Steve Lineberry
Posts: 388
Awesome!
Posts: 89
Trying to keep up with things here! I've added shocksll's improvements to the module version and figured out how to get the Javascript into the footer ({g->addToTrailer}), which is what keeps IE from choking. You can see it in action here (don't worry; that paragraph above the map is in my "local" directory, which I have not included), and you can download the module here. (I'll also try to attach the zip file here.)
billimek, that's basically what my rewrite was, only I had to make sure that it occurred before the other rewrites so that G2 would not try to find an album called "map".
--
http://severinghaus.org/gallery/
Posts: 352
Thanks HorsePunchKid. One suggestion, you probably want to increment the module version whenever you make a change. I incremented it to 0.1.1 when I did my changes and since yours is still at 0.1, anyone that is currently using mine will not be able to upgrade to yours. Can you redistribute yours as 0.1.2? Thanks for your hard work.
Steve Lineberry
Posts: 352
Also, can you please remove the extra carrage return or linefeed at the end of MapSiteAdmin.inc
That causes some of us when we save the settings to get a blank page or error. Thanks.
Steve Lineberry
Posts: 89
shocksll: Done and done. The new code is here or attached to this post. I changed the zip filename to reflect the actual version.
One thing that is probably not working properly still is the item descriptions. I have some descriptions that are a couple of paragraphs long with embedded HTML, and they do not seem to fit into the Javascript context properly. I don't know enough about Smarty's output filters ("modifiers"), and I'm also not quite sure where the Javascript is breaking syntactically.
--
http://severinghaus.org/gallery/
Posts: 352
Sweet, thanks man. Can you post a link to a map page where you have the long descriptions and I can take a look. Thanks.
Steve Lineberry
Posts: 388
ok, finally took the time to install/configure and believe I have most of it working.
This is so damn cool!
I installed map-module-0.1.2.zip and map-theme-1.0.2.zip.
My problem is that when going to the url I get this ugly error message saying, "The Google Maps API key used on this web site was registered for a different site web site".
I tried punching in multiple urls to my album directory with no luck.
The url I'm using now to get the API key is http://my.site.com/v/TravelMap/.
Using G2 1.0 embedded in WP 1.5.2 with WPG2 plugin and URL rewrite.
After clicking ok on the error message my Map displays along with the pushpins, and bottom row of thumbnails. Same behavior under Firefox.
Any ideas what I might have done wrong?
Posts: 89
I'd send a link, but somehow it started working correctly, though I don't think the changes I made (see the diff) were responsible. I should try to write a description or summary that has particularly nasty characters in it and see what happens.
--
http://severinghaus.org/gallery/
Posts: 388
After running some experiments in trying to eliminate this API key error alert in which for some cases the error does not occur for me, I've concluded that it's an issue with Google's API and mod_rewrite. It appears to be a question asked daily on Google's API forum in which many folks are experiencing same or similar issues. And since WPG2 is no longer supporting G2 url rewrite think I'll just ignore this error until Google updates their API or someone here comes up with a fix or workaround.
I've spent 3+ hours on this so perhaps tomorrow the error will disappear.
Kudos to all you guys who have done a great job with this module and map theme!
Posts: 89
For what it's worth, swordfish, when I got my API key, I just asked for the root of my website instead of the directory that the map lives in. I could definitely picture problems if you've registered for "foo.com/bar/map" and you're trying to rewrite the URL to "foo.com/bar/main.php?show=map" (roughly speaking, of course).
--
http://severinghaus.org/gallery/
Posts: 7
Has anyone else experience this error on their map page: Warning: assert(): Assertion "!empty($ids)" failed in /var/www/gallery2/modules/core/classes/GalleryStorage/DatabaseStorage.class on line 2059
a little check with phpmyadmin reports this:
Problems with indexes of table `g2_AccessMap`
Warning UNIQUE and INDEX keys should not both be set for column `g_accessListId`
Problems with indexes of table `g2_PluginParameterMap`
Warning UNIQUE and INDEX keys should not both be set for column `g_pluginType`
Warning More than one INDEX key was created for column `g_pluginType`
**FIXED** Didn't have any GPS data appended to any items...Durr
Posts: 352
Does this only happen when you have the theme or module enabled?
Steve Lineberry
Posts: 7
Yeah both are enabled. It happens when I try to go to "main.php?g2_view=map:ShowMap" which is rewritten to gallery2/map/ so when they're disabled I just get a good ol' permission denied error.
Thanks for your help btw.
Posts: 388
Think I found bug with the map theme, map module, or combination of both.
The API key text block in the map theme by default is checked (Use global).
I inserted my API key in the map module form.
Goto my website and I get the Map API alert (twice) and the map never loads.
Viewing the page source and the map API key= is blank!
If I insert the same API key in the map theme API block then the Google map loads.
I still get the API key alert (only once though and yes I did try multiple urls including the root directory) but at least it loads and is functional.
If I leave the API key in the map theme and then change the API key in the map module form to something else then the API key in the map theme is taken and the API key inserted in the map module is ignored. Think this part is correct since the Global default is now unchecked and if leaving the MAP key blank in the module the map still loads.
I did ensure I cleared all cached/template files after each map key change.
So is this a bug?
Posts: 60
I made a set of google png push pins based that match the "Web Hues" swatch pallete in Photoshop CS. I thought they might be useful for this theme so that different albums could have different colors. The individual files are not available for direct linking, but you can download the zip file or look at the contact sheet here: http://people.vanderbilt.edu/~sam.kuhn/gmaps/index.html . The file exceed the max file size for the forum, so you'll have to get it from my web space.
A better way to do this is probably just to use ImageMagick's ModulateImage command to adjust the hue on a stock pushpin, but I don't know how to do that, so I made pngs. http://www.imagemagick.org/api/enhance.php.
Posts: 388
billimek,
I'm looking at your map and trying to figure out how you linked all your pushpins to the various albums you have. I'm obviously missing a few steps and have not grasped the concept of this mapping. Other than the map album I created the rest of my G2 uses Matrix theme. Appreciate any hints.
Thanks!
Posts: 352
You need to create a custom field called GPS and enter the GPS coordinates in that field for each item in the form long, lat
Steve Lineberry
Posts: 89
swordfish: For what it's worth, I found these two sites very useful for finding the latitude and longitude of the cities I've taken photos in. Just note that they give you (latitude,longitude) when you need (longitude,latitude) for Google Maps (see here).
--
http://severinghaus.org/gallery/
Posts: 60
http://www.robogeo.com/latlonfinder/map.asp is another useful location->lat/long page. Double click on your location and then just cut and paste the values (and reorder, of course). This type of tool might even be a useful element of a fully-featured GPS system in Gallery2.
Posts: 7
Thanks for the help, that error is gone now. Going to the map page now brings up a blank window, debugging didn't reveal any obvious problems.
It just looks like a normal gallery page with the words "Photo Map" and that's it.
Another question: Now that I can include the google key in the admin page for the module, do I still need the custom field? When I registered for the google API I registered it to http://mysite/gallery2 rather than a specific folder within the site, could this be the cause?
Posts: 89
When I see the page come up blank, as you described, I first check the source for the page. Sometimes you can manually spot errors in the generated Javascript better than by using a debugger. Do you have GPS coordinates in for at least one album or photo? I haven't actually tested it when you don't have any, though I can't really think of any specific reason it would fail in that case.
If you're using the module, you don't need the custom field for the API key. All you need is the GPS field.
I don't think the URL you registered your key for would be causing this problem. When Google has a problem with your key, you get a very obvious Javascript alert box telling you there's a problem.
Posts: 352
If you are using the theme version 1.0.0 or higher you don't need the custom field for the api key.
Steve Lineberry
Posts: 7
Yeah, having no GPS coordinates gave me the initial DatabaseStorage.class error, that's fixed. I checked the source yesterday and saw no issues. It even correctly identified the 6 or so items I labeled with GPs coords.
And you were right, it isn't an issue with the API code, once I deliberately changed the key, I saw that error.
Thanks for your help so far people.
Posts: 14
What about creating an image block version of the map module too? Of course it would have to be relatively small (like 150px wide) but it would be nice if, for example, in an album of pictures from a trip to Japan to have a little mini-map on the left pointing out Kyoto in a sub-album of Kyoto pictures.
There were quite a few discussions on the GoogleMaps-API group about maps only showing markers at a certain degree of magnification too. This could work to help maintain only one map for all galleries but show different markers based on the center and magnification of the mini map.
Posts: 60
Another site that uses gmaps to determine lat/long. The code looks very simple; I'm sure it would be easy to pipe the lat/long into the appropriate custom field in Gallery. Maybe something like this, but it would have an "OK" box in the popup of lat/long to allow you to confirm that it is the right location. Of course, the map also needs zoom control, and maybe a search box to allow gross localization (say "Chicago, IL", then you can manually zoom in on the corner of 34th and Elm,etc).
http://conversationswithmyself.com/googleMapDemo.html
Posts: 5
Hi all ... loving this thread, got me really excited and I'm trying to install now for my gallery but boo hoo ... my ISP (great as they are) uses Microsoft Server so I'm having trouble figuring out how I get a nice friendly directory to feed the Google API Key generator ... I assume I can't use the ugly URL that Gallery2 is making? Or is this just impossible with IIS? (Please ... I hope not!)
Cheers
Mike
P.S. Ok so there is ISAPI_rewrite for IIS ... but I saw the post http://gallery.menalto.com/node/32793 and there was no conclusion whether this works or not ... anyone know if G2 can do URL re-writes with ISAPI_rewrite on M$ IIS? Ah ... hang on now I just found this too ... http://gallery.menalto.com/node/11275 ... lesson here is always search the forums for the answer before posting!
Posts: 352
I use iis as well, you just need your domain name for the api like http://pictures.thelineberrys.com/
Steve Lineberry
Posts: 7
If anyone has some free time, I'd appreciate any help regarding my annoying problem. Attached is the source to my map page, and if anyone can see something wrong with it, please let me know.
Thanks
***FIXED*** Ah nevermind, My Map theme was in the wrong place due to carelessness. Thanks
File removed
And yes, I have the same API issue as the poster below me.
Posts: 5
Hmm ... yes I tried this and it kinda works.
Go to http://www.mjhughes.co.uk/gallery2 and click the travel album ...
Error: "The Google Maps API key used on this web site was registered for a different web site. You can generate a new key for this web site at http://www.google.com/apis/maps/." but on clicking OK the page loads OK anyway!
I generated the key for http://www.mjhughes.co.uk/gallery2 so it should have worked no?
Cheers
Mike
Posts: 5
... strangley if I check he show descriptions box it fails totally and I just get the error box and a blank page when I check OK. Also, either way I am unable to set a highlight for the album Travel Places ... is this possible even though it has the map theme?
must go to bed ... zzzzzzz
Mike
Posts: 388
Hi all,
Thanks for the tips/links on Lat/long. Now I have new problem.
I've spent untold hours getting the Google map to function and format to my WordPress/G2 site with url_rewrite. First the issue with the damn API key, then url_rewrite, formatting issues, then css hacking and list goes on. Anyways just when I got it all working (viewing under Firefox) I checked with IE6 and when the map went to load I get this infamous error, "Operation Aborted" and get dropped out to page cannot be displayed. Jeez, you've got to be kidding me!! Searching through Google's API forum I see alot of people have the same issue. I tried modifying the map theme (theme.tpl) to have the javascript code in the <head> section along with a <body onload="mapload();"> but so far no luck. Still works fine in Firefox though. It seems IE either has a bug or the Map theme does not conform to standards; I'm not sure and certainly not blaming anyone here. See Operation Aborted.
I'm also not sure if this error is somehow due to my G2 embedded under WP. So close yet so far, argh!
shocksll, Could you please help me out?
Posts: 2
i'v had the same prob.
Put your google javascript in a function. Call this function just below it self with window.onload = googlemap;
like:
may it helps!!
regards roman
Posts: 388
intrinsic
Thanks for the help but unfortunately did not help. No matter what I try IE always loads the map but then get the Operation Aborted crap. Think my problem is...
1) Where exactly should I put this Google javascript since I'm using the Map module and the Map theme?
2) I've tried modifying the map theme (theme.tpl) and even placing the Google javascript in my WP header file but still get same error.
3) Using a function to call the Google map seems to work for everybody but me.
4) I've tried so many options I now need to start all over again.
5) I've read the IE problem as described here but yet still can't get it to work. I feel totally hopeless.
Posts: 388
Update on my long drawn out dilemma...
Map loads fine when G2 is NOT embedded - http://my.site/gallery2/main.php?g2_view=map:ShowMap
When G2 embedded w/ WordPress - http://my.site/blog/wp-gallery2.php?g2_view=map:ShowMap
I get the operation aborted error in IE. Works fine in Firefox.
Any ideas on a workaround or fix?
If it helps anyone the below code is the bottom portion of my Google Map page (view page source)
using Firefox.
Posts: 89
swordfish: This won't be fun, but one last resort technique for debugging stubborn code like this (when you don't have a stepper) is to just put a "print" statement between every line of code. Print out a different value at each step, and you'll be able to see what step it's throwing that error on: the one right after the last successful print statement. I think the closest analog to "print" in Javascript is probably alert(); I'm not sure that document.write() or whatever would be very reliable.
For what it's worth, I had all sorts of problems in IE until I realized that for no apparent reason, the Javascript has to go at the very end of the document. Note how in my map, the script isn't inside any div at all. I think that's something you should try. Get that Javascript down outside of the divs, right next to the closing body tag, if possible.
--
http://severinghaus.org/gallery/
Posts: 2
FYI, if you have any type of quotes in your albums title or comments you will get an error. I just spent the last 2 hours of my life trying to figure this out!