Google Maps + Gallery

HorsePunchKid
HorsePunchKid's picture

Joined: 2005-05-04
Posts: 89
Posted: Wed, 2005-10-05 23:59

Shr00m: I've been working on that here and there. Are you using the module or the theme? I'll go back through and see what places I've missed in the module; it's really easy to end up dumping out characters that break the code when you've got PHP wrapped in Smarty generating Javascript inside an HTML document. ;-)

--
http://severinghaus.org/gallery/

 
swordfish
swordfish's picture

Joined: 2004-10-01
Posts: 388
Posted: Thu, 2005-10-06 02:33

HorsePunchKid
Mucho thanks for the help!! The alert() function helped alot but I couldn't narrow it down
to one specific command or line of code. I then completely removed my footer and got my code
aligned nearly identical to yours as you suggested. Removing the footer and hence this removed
the DIV tags still had the same annoying error. After pulling some more hair out I was comparing
the ShowMap.tpl from map-module-0.1.2 and map-module-0.1.1. Since I didn't think my situation
could possibly get any worse I replaced this file with the file from map-module-0.1.1.
Then browsed to my site url for the 100th time and Presto the map loaded w/o Operation aborted error.
I then put the footer back in and amazingly it still works in IE6.

I don't yet understand why the older version template works and not the newer one.??
Anyways, I'm finally at peace and now need to do some css cleanup.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2005-10-06 02:51

I have been following this thread for some time and have some spare time to implement it.
However the attachments don't seem to work. like in this post:
http://gallery.menalto.com/node/32642?from=50#comment-137189

Can somebody please attach the module and theme again. If that does not work send them to me and I will host them for download.

Cheers!
Dave
Gallery Frames / Mods || G1 Test Gallery

 
swordfish
swordfish's picture

Joined: 2004-10-01
Posts: 388
Posted: Thu, 2005-10-06 03:35

See if these work. Use Firefox to download them, not IE.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2005-10-06 04:29

Perfect. Thanks
Must be this PC ... with XP the downloads dont work but in FF they do..... but on another machine (win2k) they download just fine. Another one for Bill to explain. ;-)

Dave

Gallery Frames / Mods || G1 Test Gallery

 
HorsePunchKid
HorsePunchKid's picture

Joined: 2005-05-04
Posts: 89
Posted: Thu, 2005-10-06 07:18

Minor bug with the map module: If you add GPS coordinates to an album that has no children, you'll get an error that cause the whole map page not to render. It should be easy enough to fix. Hopefully I can get a new version out soon. If anyone's interested, I just hacked out this updates module in the last hour. It seems to work reasonably well. Now that that's out of the way, I'll get back to work on the map code.

--
http://severinghaus.org/gallery/

 
siddharthasaha

Joined: 2005-10-06
Posts: 1
Posted: Thu, 2005-10-06 09:59

Hey, this is great. I was trying to implement something like this, and found that it has already been done. Great job.

One small hiccup: (I don't know if it is only me - please confirm). I am using the map-module. If any album name has a single quote in it, then I think the module breaks - i.e., no map rendering. It is too late tonight, almost 3am, so I don;t want to look at the code now. This is just a small (maybe) bug report. :)

~ Siddhartha

http://siddharthasaha.net

 
shocksll
shocksll's picture

Joined: 2005-06-22
Posts: 352
Posted: Thu, 2005-10-06 11:23
swordfish wrote:
I don't yet understand why the older version template works and not the newer one.??

HorsePunchKid is the official creater/maintainer for the module but I added some modifications to the module. What I did to fix the IE problem in the theme was to set the window.onload event to run the map code. HorsePunchKid took a different route and added it to the trailer. Version 0.1.1 is the one that I modded that does the onload event. Version 0.1.2 is the one HorsePunchKid did where he put the code in the trailer. The IE problem is that IE doesn't like JS adding content using innerhtml to a tag that isn't closed yet. So theoretically both should work. I belive the trailer method won't work if the trailer is wrapped inside a div that also includes the div tag for the map and the onload method doesn't seem to work on some CMS's like Wordpress which I assume is because it's not allowing the onload event to run or it's causing that event to run too early.

 
HorsePunchKid
HorsePunchKid's picture

Joined: 2005-05-04
Posts: 89
Posted: Thu, 2005-10-06 19:13

I'm not sure I've addressed all the problems (in fact, I'm pretty sure I haven't), but here is version 0.1.3 of the map module. Please read the README; that's why it's called that. ;-)

I have fixed the problem with quotes in album titles, changed the date label to use whatever date format you specified in the "general" site admin section, added some parameter validation in the admin form, and commented the code a bit. The parameter validation is the only thing i'm worried about, since i haven't tested it exhaustively. If you have trouble, just open MapSiteAdmin.inc, go to line ~88, and comment out all of the code except the final "else" clause that saves the parameters.

--
http://severinghaus.org/gallery/

 
LarryDoliver

Joined: 2003-12-31
Posts: 35
Posted: Thu, 2005-10-06 22:26

Folks,

I'm getting several error log messages saying /www/htdocs/mapfiles does not exist. The referring page is my map: http://tautologous.com/gallery2/travel. I've grepped the source, 'mapfiles' isn't there anywhere. Ideas?

 
HorsePunchKid
HorsePunchKid's picture

Joined: 2005-05-04
Posts: 89
Posted: Thu, 2005-10-06 22:53

I don't know what's causing it, but I do see the string "mapfiles" in code that Google provies. Like this, for example: http://maps.google.com/mapfiles/maps.23.js

How it's turning into a request from my server, I don't know...

Edit: In my logs, I'm getting occasional requests for /mapfiles/iw_tab.png and variations on the "tab" part. You can see that in the Javascript I linked to above. There's some variable "r" (the root of the webserver?) that gets set to another variable called _mStaticPath, but I can't find where that variable is initialized. I'd blame it on bad browsers messing up the Javascript, but I've seen it from both IE6 and Safari.

--
http://severinghaus.org/gallery/

 
LarryDoliver

Joined: 2003-12-31
Posts: 35
Posted: Thu, 2005-10-06 23:29

yeah, that or google's changing the javascript and introducing a bug or two. Seems these stared on Tuesday, and ended today.

FYI, the api key javascript has:
var _mStaticPath = 'http://www.google.com/intl/en_ALL/mapfiles/'

 
swordfish
swordfish's picture

Joined: 2004-10-01
Posts: 388
Posted: Fri, 2005-10-07 03:49

shocksll, Thanks for clearing this up. Now it makes much more sense to me.

Tried the new map-module-0.1.3 and it worked for me; however for now I kept the older
ShowMap.tpl in place.

 
swordfish
swordfish's picture

Joined: 2004-10-01
Posts: 388
Posted: Fri, 2005-10-07 04:57

On the Google map buttons (Map, Satellite, Hybrid) is it possible to change the font color?
Using css or the javascript code? I'm using a modified Matrix theme along with the Black color pack.

Thanks!

 
HorsePunchKid
HorsePunchKid's picture

Joined: 2005-05-04
Posts: 89
Posted: Fri, 2005-10-07 19:56

I don't want to release a new version just for this, but if you open up your modules/map/module.inc and add this code (around line 72 or so, though it doesn't really matter), you can avoid having to fiddle with your .htaccess file to do the URL rewrite:

    /**
     * @see GalleryModule::getRewriteRules()
     */
    function getRewriteRules() {
        $rule=array();
        $rule['comment']='View Map';
        $rule['match']=array('view' => 'map.ShowMap');
        $rule['pattern']='map/';
        return array($rule);
    }

Once you've done that, just go into the Site Admin page for the URL rewriting module and hit the checkbox under "Map". You can configure the exact URL it will look for; by default it's just "map/" as on my site: http://severinghaus.org/gallery/map/

I am consistently surprised at how easy it is to work with the G2 code, now that I've gotten past the initial spike in the learning curve. Nice work, development team! :-)

--
http://severinghaus.org/gallery/

 
swordfish
swordfish's picture

Joined: 2004-10-01
Posts: 388
Posted: Fri, 2005-10-07 21:57

Thanks HorsePunchKid for the url_rewrite code! Works like a charm including for G2 embedded in WP.
On another note; don't know if you're accepting feature requests but having a "Zoom in" link on the map thumbnail when clicking a pushpin would be very cool.
See example: http://www.gorissen.info/Pierre/maps/map_uk_2005.php?zoom=All

 
HorsePunchKid
HorsePunchKid's picture

Joined: 2005-05-04
Posts: 89
Posted: Fri, 2005-10-07 22:42

I am happy to consider feature requests as long as those requesting features are not offended when I reject them. :)

I think could probably add a zoom link, though it would be non-trivial to replicate the functionality of the site you linked to. He has it set up so that when you zoom to a location, a different set of pushpins come up, which would involve storing a mapping between some high-level set of points and the points that should show up when that point is selected.

What would be easier is to first give the option of having the zoom slider show up, which I removed for no good reason, actually. When you have a pushpin selected and zoom in, it stays centered on that pushpin. The problem at the moment is that you have to keep hitting "+" until you get tot he level you want.

Second, you could have a sort of "secondary" zoom level that would be the zoom level to go to when you hit the "zoom in" link. That would be easy to do, and at least for me would cover most of the uses I would have for this sort of functionality.

By the way, this Google Maps EZ thing that is used on that site is pretty nifty if you haven't seen it.

--
http://severinghaus.org/gallery/

 
swordfish
swordfish's picture

Joined: 2004-10-01
Posts: 388
Posted: Fri, 2005-10-07 23:17

HorsePunchKid
No problem, I understand. You da man! Using your module I actually put the zoom slider back in. Yes, the secondary zoom level would be perfect for me as well. Yea, that Maps EZ is quite cool.
One other snippet of code is I'd like the pushpins to be say green for an album and red (or whatever color) for a picture. Believe the Map theme has this but decided not use it and just continue editing my Matrix theme.

 
samkuhn2

Joined: 2004-04-13
Posts: 60
Posted: Sat, 2005-10-08 18:22

For long term development, it would probably be good if this module first checked to see if a photo had GPS data in the GPS EXIF fields and autofill the custom GPS field.

While few cameras have GPS EXIF coding built in, there are a number of programs that will allow insertion of GPS data in to EXIF files based on time synchronization of a GPS track and EXIF time stamps.

A good summary of GPS tags in EXIF standard here:
http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/GPS.html
GPSLatitude
GPSLatitudeRef
GPSLongitude
GPSLongitudeRef
GPSAltitude
GPSAltitudeRef

EXIF 2.1 and 2.2 support location coding as follows:
Exif 2.2 specs:
http://www.exif.org/Exif2-2.PDF
GPS tags on page 52

Exif 2.1 specs:
http://www.exif.org/Exif2-1.PDF
EXIF 2.1(DCF Version) specs:
http://www.exif.org/dcf-exif.PDF
GPS specs on page 56-64 (acrobat numbers the pages 62-70) in both pdfs

It appears that issues with exifer tool utilized by G2 reading GPS out of EXIF tags has been resolved:
http://sourceforge.net/tracker/index.php?func=detail&aid=1108295&group_id=7130&atid=357130
resolved here:
http://sourceforge.net/tracker/index.php?func=detail&aid=1123730&group_id=7130&atid=307130

 
HorsePunchKid
HorsePunchKid's picture

Joined: 2005-05-04
Posts: 89
Posted: Sun, 2005-10-09 04:49

I've made a substantial update, which I'm realeasing as version 0.2. You can get it here or find it attached below. From the README:

Version 0.2 contains a number of enhancements:
- Obeys gallery permissions for viewing items
- Different icons for albums versus photos
- Zoom links for items, zoom scale control
- Tie in to URL rewriting module

As always, please let me know if you have any trouble. One thing I added that I didn't mention in the README is that the module attempts to autoconfigure itself now, setting defaults for everything but the Google Maps API key. This should make it easier for new users to get started, I think, but of course you've still got to get the key in there before it works. This shouldn't interfere with those of you who are upgrading from a previous version, in any case.

Thanks for your suggestions, everyone!
-Steve

--
http://severinghaus.org/gallery/

 
HorsePunchKid
HorsePunchKid's picture

Joined: 2005-05-04
Posts: 89
Posted: Sun, 2005-10-09 05:30

Thanks for the EXIF info, samkuhn2. I guess if we try to position photos based on their EXIF info, we'd need to cache it somehow. I think the EXIF module does this already, since there's a site admin function for refreshing the cache. I don't see anything obvious in my database schema that might store EXIF properties, though. Ideally, you could just query for all items that have the necessary GPS EXIF fields filled out and work with the results just like we currently do for the custom field.

--
http://severinghaus.org/gallery/

 
swordfish
swordfish's picture

Joined: 2004-10-01
Posts: 388
Posted: Sun, 2005-10-09 08:50

hey HorsePunchKid,
The 0.2 version works great and thanks for the new features! Very nice!
I did have to edit the ShowMap.tpl slightly in order for it to work on my site.
I have a minor issue with the error checking you added. Entering any coordinates for the "Center On' field always returns error 'Please make sure you have formatted the coordinates correctly' after clicking save. I tried multiple Lat/Long values including reversing the order and the only value it would take is 0,0.
Also, entering any value other than 0,0 and then choosing to enable any of the optional checkboxes for the first time renders them disabled (unchecked) when saving. Not sure if thats by design but in order for me to get the Zoom links I had to enter 0,0 for Lat/Long.

 
HorsePunchKid
HorsePunchKid's picture

Joined: 2005-05-04
Posts: 89
Posted: Sun, 2005-10-09 08:57

I'll see what I can do about the problems with the "center on" validation. I tried a few reasonable values, and they all seemed to work. (For example, I use -40,40 as my default center.) The regexp is fairly complex, and it could well have problems:
/^[-+]?[0-9]{0,2}(\.([0-9]{0,12})?)?,[-+]?[0-9]{0,2}(\.([0-9]{0,12})?)?$/

If anyone sees anything glaringly wrong, let me know. I know it would technically accept the string "," as valid, but fixing that will be somewhat annoying, and I think it would be pretty obvious to the user that that was unacceptable. :-)

--
http://severinghaus.org/gallery/

 
swordfish
swordfish's picture

Joined: 2004-10-01
Posts: 388
Posted: Sun, 2005-10-09 10:09

Hmm, now that you mention it -40,40 works for me as well. I was trying to zero in on a centerpoint like -115.490650,37.143032. Not a big deal though.

 
OwenF

Joined: 2005-04-16
Posts: 19
Posted: Sun, 2005-10-09 11:19

Just going to add a big thank you to everyone thats been involved with this especially HorsePunchKid!

Added the module to my site and after a lot of headbanging with the IE Operation Aborted problem when the gallery is embedded in wordpress. However thanks to Swordfish and Shocksll and their posts about this it's all sorted.

cheers folks :)

Owen

----
www.gonewalkabout.info

 
Termitenshort
Termitenshort's picture

Joined: 2005-10-09
Posts: 1894
Posted: Sun, 2005-10-09 16:18

First of all, I want to say thanks for this AWESOME addition to gallery, I love having this on my site :-). Great work.

I'm not sure if anyone is interested but I have made a slight change to the code to incorporate a new field ("color")
so that it is possible to select a color for the markers when putting the coordinate for an album.

In fact it point to a bunch of PNG files located on your site. I currently also have markers in 10 colors

I personnally use that to differenciate who went to the vacation spot :-)

Let me know if anyone is interested! (I can also upload the Markers if needed)

-------------------------
The Termite :-)

 
Termitenshort
Termitenshort's picture

Joined: 2005-10-09
Posts: 1894
Posted: Sun, 2005-10-09 16:32
Quote:

/^[-+]?[0-9]{0,2}(\.([0-9]{0,12})?)?,[-+]?[0-9]{0,2}(\.([0-9]{0,12})?)?$/
.
If anyone sees anything glaringly wrong, let me know. I know it would technically accept the string "," as valid, but fixing that will be somewhat annoying, and I think it would be pretty obvious to the user that that was unacceptable. :-)

I think to prevent the "," string, this would do the trick:

/^[-+]?[0-9]{1,2}(\.([0-9]{0,12})?)?,[-+]?[0-9]{1,2}(\.([0-9]{0,12})?)?$/

Also I was also having problem with saving my center coordinate and it seems that the current regexp does not allow 3 digit numbers so I believe to fix both problems (the one mention above and this one) we should have something like:

/^[-+]?[0-9]{1,3}(\.([0-9]{0,12})?)?,[-+]?[0-9]{1,3}(\.([0-9]{0,12})?)?$/

It seems to have fixed all issues on my site :-D

Cya

-------------------------
The Termite :-)

 
samkuhn2

Joined: 2004-04-13
Posts: 60
Posted: Sun, 2005-10-09 20:07

The free wwmx software here:
http://wwmx.org/Download.aspx
will allow you to tag GPS data into EXIF tags by dragging and dropping the untagged photo on to a map.

It is Windows only as it requires .net, but it is free.

There are links at the bottom of the page linked above to other software with similar functionality (most of it not free though).

[edit]
Free Mac software here that does the same thing:
http://oregonstate.edu/~earlyj/gpsphotolinker/
This software looks much nicer than the WWMX software above.

 
swordfish
swordfish's picture

Joined: 2004-10-01
Posts: 388
Posted: Sun, 2005-10-09 23:24
Termitenshort wrote:
First of all, I want to say thanks for this AWESOME addition to gallery, I love having this on my site :-). Great work.

I'm not sure if anyone is interested but I have made a slight change to the code to incorporate a new field ("color")
so that it is possible to select a color for the markers when putting the coordinate for an album.

In fact it point to a bunch of PNG files located on your site. I currently also have markers in 10 colors

I personnally use that to differenciate who went to the vacation spot :-)

Let me know if anyone is interested! (I can also upload the Markers if needed)

-------------------------
The Termite :-)

Yea, cool! I'm definitely interested. Please upload and/or provide a link to download.
Your revised regexp worked for me too.

Thanks!

 
HorsePunchKid
HorsePunchKid's picture

Joined: 2005-05-04
Posts: 89
Posted: Mon, 2005-10-10 03:41

Termite, your regexp is better, since you can have three digits in the integer part of the coordinates, but {1,3} wouldn't allow something like ".5,2", which should probably be accepted.

Any code you want to share would be most welcome! Does anyone have a list of what icons (pushpins) Google provides? I noticed Google Maps EZ has a bunch, and I presume that they're custom-made (GPLed, but I don't see where to download them).

--
http://severinghaus.org/gallery/

 
swordfish
swordfish's picture

Joined: 2004-10-01
Posts: 388
Posted: Mon, 2005-10-10 05:28

HorsePunchKid,
Try searching the GoogleMapki site.

Huge resource depot and map projects here.

 
swordfish
swordfish's picture

Joined: 2004-10-01
Posts: 388
Posted: Mon, 2005-10-10 07:02

I came across a few other cool map hacks.
TLabel API Extension
Adds tooltip style mouseover infowindows.
Check it out here - http://gmaps.tommangan.us/tlabel.html
Another one here - http://mapki.com/forums/viewtopic.php?t=178

TPhoto - Overlay images
http://gmaps.tommangan.us/tphoto.html
http://gmaps.tommangan.us/groom_lake.html

 
samkuhn2

Joined: 2004-04-13
Posts: 60
Posted: Mon, 2005-10-10 13:11
HorsePunchKid wrote:
Termite, your regexp is better, since you can have three digits in the integer part of the coordinates, but {1,3} wouldn't allow something like ".5,2", which should probably be accepted.

Any code you want to share would be most welcome! Does anyone have a list of what icons (pushpins) Google provides? I noticed Google Maps EZ has a bunch, and I presume that they're custom-made (GPLed, but I don't see where to download them).

I wrote the author of Google Maps EZ an email asking how he generated his icons. Given that Gallery is multilingual, if it is possible, it would probably be best to generate the pushpins on demand or on install based on the allowed language sets in Gallery. I have been looking in to how to do that with Imagemagick but have not yet finished testing out my efforts.

As I mentioned earlier, generating the pushpins on the fly, or at install with Imagemagick would be a boon in terms of both file management (fewer files to distribute) and more flexibility (different language fonts, universal hue/saturation/brightness).

 
makro
makro's picture

Joined: 2005-10-10
Posts: 12
Posted: Mon, 2005-10-10 19:12
risp wrote:
I don't get the part about the GPS custom field. Do i have to add a GPS field for the album or the photo? It's impossible to add GPS to photo and album.
EDIT nevermind i should read better next time :)

Could you please explain to me how you solved this, because i really don't get it (stupid, but i don't realise how to link to albums instead of single pictures). Thanks.

PS: To all the developers here, thanks so much for this wonderful piece of software!!

 
bugz

Joined: 2005-09-18
Posts: 8
Posted: Mon, 2005-10-10 20:05
makro wrote:
risp wrote:
I don't get the part about the GPS custom field. Do i have to add a GPS field for the album or the photo? It's impossible to add GPS to photo and album.
EDIT nevermind i should read better next time :)

Could you please explain to me how you solved this, because i really don't get it (stupid, but i don't realise how to link to albums instead of single pictures). Thanks.

PS: To all the developers here, thanks so much for this wonderful piece of software!!

When you create the custom field "GPS" it places it a tab in the edit section for either the image or the album. If you select "edit album" then click on the custom fields tab (matrix theme) you should be able to enter your GPS coordinates here which will create the link to the album with it's current highlight image.

That's how it works for me anyway.

 
makro
makro's picture

Joined: 2005-10-10
Posts: 12
Posted: Mon, 2005-10-10 20:28

bugz, thx for your help. But how do i connect the album then to the maps album?
I feel like an idiot cause i don't get it at all.
Maybe i am just thinking wrong, i will explain how i did it with the single fotos. I have albums like this:

> Travel >> Travel-1 >>> Travel-2 >>>> Travel-3 ...

and then a album

> GoogleMaps

so i linked fotos from the Travel-Albums to the GoogleMaps Album (childs).

How can i have my normal Albums beside the GoogleMaps-Album and just link to them from inside the GoogleMaps-Album? Because i will use different Templates/Themes in different albums, and for the GoogleMaps i have to use the maps-Theme. Or do i just mix something terribly up?

 
Termitenshort
Termitenshort's picture

Joined: 2005-10-09
Posts: 1894
Posted: Mon, 2005-10-10 22:37

Hello, well I'm glad I could help fixing a very small bug, sometimes just a new set of eyes helps :-)

Anyways I have included as a download my version of the 0.2 code (I named it 0.2b) and the markers in two diffferent sizes :-)

Changes compared to original version:
- MapSiteAdmin.inc now include the corrected Regexp
- ShowMap.inc include a query for the "color" field and include it in the "pointhash"
- ShowMap.tpl (I know I shouldn't have ... sorry) to select the icon to use on the fly depending on the selection made for each album marker

How to Instal this:
1. Unzip the content of map-module-0.2b.zip to overwrite you existing files
2. Unzip the content of map-marker-20.zip to a new folder under /gallery2/images called "map"
3. Add a "CustomField" called "color" and enter the list of possible value (to avoid errors later on)

When you enter your GPS coordinate into the Albums' CustomField, you have the option to select a color, if you don't select anything it will default back to the green marker.

One more thing: If you wish to use the "34" sized marker, you would have to edit Manualy the "ShowMap.tpl" file in the template directory of the module and modify the name of the iconImage:

albumIcon.image = "/gallery2/images/map/marker_20_{$point.color}.png";
Would become
albumIcon.image = "/gallery2/images/map/marker_34_{$point.color}.png";

Let me know if you are having any trouble :-D

-----------------------
The Termite :-)

 
bugz

Joined: 2005-09-18
Posts: 8
Posted: Tue, 2005-10-11 02:36
makro wrote:
bugz, thx for your help. But how do i connect the album then to the maps album?
I feel like an idiot cause i don't get it at all.
Maybe i am just thinking wrong, i will explain how i did it with the single fotos. I have albums like this:

> Travel >> Travel-1 >>> Travel-2 >>>> Travel-3 ...

and then a album

> GoogleMaps

so i linked fotos from the Travel-Albums to the GoogleMaps Album (childs).

How can i have my normal Albums beside the GoogleMaps-Album and just link to them from inside the GoogleMaps-Album? Because i will use different Templates/Themes in different albums, and for the GoogleMaps i have to use the maps-Theme. Or do i just mix something terribly up?

Hey Makro,

Just to get this straight, you want this:

http://www.wildcard.co.nz/modules/gallery2/main.php?g2_view=map.ShowMap

With an gallery list like this down the sidebar:

http://www.wildcard.co.nz/modules/gallery2/main.php?g2_view=core.ShowItem&g2_itemId=49&g2_navId=x24c0b63d

Is that correct or am I getting you wrong?

 
swordfish
swordfish's picture

Joined: 2004-10-01
Posts: 388
Posted: Tue, 2005-10-11 05:03

Termitenshort
Your 0.2b version works great, thanks! I was wondering if you could modify so in addition to an Album
the option of selecting a color icon for an Image can be chosen.?

Thanks!

 
Termitenshort
Termitenshort's picture

Joined: 2005-10-09
Posts: 1894
Posted: Tue, 2005-10-11 06:16
swordfish wrote:
Termitenshort
Your 0.2b version works great, thanks! I was wondering if you could modify so in addition to an Album
the option of selecting a color icon for an Image can be chosen.?

Thanks!

Sure I don't see a problem, here you go :-). The only catch here is that if you do not select a color for an image it will also default to green (which could be a problem I guess)

the reason for this is that I'm not that great of a programer and I'm not sure how to figure out which item is a photo and which item is a album within the "ShowMap.inc" file. Maybe HorsePunchKid can help out for this :-)

Anyways, this version will let you specify a color for any photo or album. Of course, the CustomField has to be set for both :)

See you

----------------------
The Termite :)

 
Termitenshort
Termitenshort's picture

Joined: 2005-10-09
Posts: 1894
Posted: Tue, 2005-10-11 06:43
HorsePunchKid wrote:
Termite, your regexp is better, since you can have three digits in the integer part of the coordinates, but {1,3} wouldn't allow something like ".5,2", which should probably be accepted.

In order to address the second issue the following can be used

/^[-+]?(([0-9]{1,3}(\.[0-9]{0,12})?)|(\.[0-9]{1,12}))(\040)*,(\040)*[-+]?(([0-9]{1,3}(\.[0-9]{0,12})?)|(\.[0-9]{1,12}))$/

This will then allow from 0 to 3 digit before the "." and from 0 to 12 digit after the ".", it will also prevent a string like ","

Btw it also allow for spaces before and after the "," just in case ;)

PS: included this change in the "c" version and re-uploaded it for easier install ("d" version now ....)

-----------------------
The Termite :-)

 
swordfish
swordfish's picture

Joined: 2004-10-01
Posts: 388
Posted: Tue, 2005-10-11 07:15

Termitenshort,
Thanks for the quick update!! Works great and plenty adequate for my needs.

 
samkuhn2

Joined: 2004-04-13
Posts: 60
Posted: Tue, 2005-10-11 14:18

I heard back from the author of GoogleMaps EZ, Chouser. below is our discussion:

Quote:

Sam Kuhn wrote: [Tue Oct 11 2005, 06:51:39AM EST]
> Are you releasing the code of the mkicons.pl under GPL? Do you mind
> if I post it with credit to you in the previously linked thread on the
> Gallery discussion forum?

Yep, that's all GPL. I'll put up a better link (version number, license, readme, etc.) at some point, but I didn't want to slow you guys down if you wanted to start using it right away. I would hate for my laziness to be the cause of any duplicated effort.

Sure go ahead and modify it, repost it, whatever you need. I guess I should have put a copyright notice in the perl script, but just mentioning my name and/or the GMapEZ URL should be fine for now.

> Thank you for sharing your code.

You're quite welcome, I hope it's useful for you.

--Chouser

Here is his code:
http://bluweb.com/us/chouser/gmapez/gmapez.tar.gz

/*
* GMapEZ mkicons.pl -- creates custom icons for GmapsEZ
* Copyright (C) July 2005 by Chris Houser <chouser@bluweb.com>
*
* This code is licensed under the GNU General Public License (GPL)
*
* If you use this code on a web page, please include on that page a
* link to http://bluweb.com/chouser/gmapez/ -- this is a request, not
* a requirement. Thanks.
*/

Quote:
#!/usr/bin/perl -w
use strict;

my %offset = (
# 'icon' => '-1,-7',
'marker' => '0,-6',
);

my %colors = (
'ORANGE' => '',
'PURPLE' => '-modulate 95,127,255',
'YELLOW' => '-modulate 95,127,127',
'GREEN' => '-modulate 95,127,159',
'BLUE' => '-modulate 95,95,31',
'RED' => '-modulate 95,255,95',
'AQUA' => '-modulate 95,255,191',
'WHITE' => '-modulate 95,0,0',
'GRAY' => '-modulate 47,0,0',
);

my @syms = grep { /[0-9A-Za-z]/ } &chars;
push @syms, qw( HASH DOLLAR DOT START END );

sub chars
{
my @chars = ();
for( my $i = 1; $i < 255; ++$i ) {
push @chars, chr( $i );
}
return @chars;
}

foreach my $base (keys %offset) {
foreach my $color (keys %colors) {
foreach my $symname (@syms) {
my $char = $symname;
$symname eq 'HASH' and $char = '#';
$symname eq 'DOLLAR' and $char = '$';
my $outname = "iconEZ2/$base-$color-$symname.png";
my $srctype = "blank";
my $textcmd = qq{-pointsize 12 -draw "gravity Center text $offset{$base} '$char'" -font /usr/share/fonts/corefonts/arialbd.ttf};
if( grep { $symname eq $_ } qw( DOT START END ) ) {
$textcmd = '';
$srctype = $symname;
}
if( ! -e $outname ) {
print "$outname\n";
system qq{convert $textcmd $colors{$color} origIcons/$base-$srctype.png $outname};
}
}
}
}

Attached is the perl imagemagick script, the javascript for googlemaps EZ and the stock icon set.

I'm not clear how Gallery handles fonts, especially international fonts, and if that can mesh with the script above. Right now it relies on arialbd.ttf . As I mentioned in my previous post, ideally this script would support all the characters that Gallery supports.

I tried to directly attached the .tar.gz archive for this script to this message, but the forum balks saying that .tar.gz is an invalid extension. See the link above for the download set.

 
Termitenshort
Termitenshort's picture

Joined: 2005-10-09
Posts: 1894
Posted: Tue, 2005-10-11 15:52

samkuhn2:
Thanks for getting this, I looked at the code for EzMaps and it seems he is using the same technic (various PNG file) to display the markers.

the piece of code that creates the icon is of most interest, if I understand correctly, the idea would be to have the markers automaticaly created when the module is installed ?

if that's the case, I would be glad to look into that it seems an interesting challenge :D

-----------------------
The Termite :-)

 
makro
makro's picture

Joined: 2005-10-10
Posts: 12
Posted: Tue, 2005-10-11 16:36
bugz wrote:
Just to get this straight, you want this:
...
With an gallery list like this down the sidebar:
...
Is that correct or am I getting you wrong?

Quite, actually it looks like this: http://tinyurl.com/9vnp6

Also i attached an image which is explaining it better, i think. There you see that GoogleMaps is a subalbum, and i thought that i could link from evreywhere inside the other albums to this one. But you have your GoogleMaps-Album as a Root-Folder/Album, so maybe i have to set up a GoogleMaps-Album in the root of my gallery to be able to link from everywhere inside the tree, not outside the foldertree.

 
leperm

Joined: 2005-10-11
Posts: 4
Posted: Tue, 2005-10-11 16:57

I'm totally confused and I don't want to be.
I don't understand how I can get this working. I understand this is only in development stages and the last thing people want to think about is comprehemsive documentation but a run down of the exact order things have to be done would be useful.

Install maps module - I understand that bit
Get googlemaps key - I've done that, but I'm not sure where to link it to, do I have to get a seperate key for each album?

Can anyone help?
PLease don't shout at me! I really want to get this working.

 
samkuhn2

Joined: 2004-04-13
Posts: 60
Posted: Tue, 2005-10-11 16:59
Termitenshort wrote:
samkuhn2:
the piece of code that creates the icon is of most interest, if I understand correctly, the idea would be to have the markers automaticaly created when the module is installed ?

Run on install would be fine, although in that case you could just run it before distributing the package. I think more clever would be to run on demand so that a user can choose an arbitrary character/color/pin graphic. It would create a lot of small pngs just to cover common letters+symbols+colors+graphics for the most common languages. For an exhaustive library for all languages would be unachievable considering that UTF8 includes 2^16 chars. If the module is going to generate all the pngs on install, I would suggest it do that based on the installed languages in that Gallery.

I don't really understand how language specific font sets or symbols are handled by Gallery. It uses UTF8, but beyond that I am useless.

 
shocksll
shocksll's picture

Joined: 2005-06-22
Posts: 352
Posted: Tue, 2005-10-11 18:08
leperm wrote:
I'm totally confused and I don't want to be.
I don't understand how I can get this working. I understand this is only in development stages and the last thing people want to think about is comprehemsive documentation but a run down of the exact order things have to be done would be useful.

Install maps module - I understand that bit
Get googlemaps key - I've done that, but I'm not sure where to link it to, do I have to get a seperate key for each album?

Can anyone help?
PLease don't shout at me! I really want to get this working.

If you just entered your base url when you got the api key then you only need one api key for your site. Basically when you request the goolemap code from their server, they check the api key you provided and the url which the request is coming from. If the url you provided when you got the key is a substring of the url which the request is coming from then everything works fine. So for instance, if I have two gallery2 installs on my server, one at http://www.example.com/gallery2/ and the other at http://www.example.com/gallery2.1/ and when I signed up for the api key I put down http://www.example.com/ then I should be able to use the same key for the module/theme in BOTH gallery2 and gallery2.1 installs. Now if I gave google the url http://www.example.com/gallery2/ then I would have to request another api key to get http://www.example.com/gallery2.1/ working. Does this make sense?

Next you need to create a common custom field called GPS. I would suggest doing this for the whole site under site admin.

Then you need to go to the album that contains other albums or photo you have GPS coordinates for. Edit the album or photo, click custom fields and enter the coordinates in for that item in the form long,lat .

For the module goto site admin, click on the map link on the left. Enter your api key into the appropriate field.
Ok as far as accessing the module, you have to go to the url similar to below:

http://www.example.com/gallery2/main.php?g2_view=map.ShowMap&g2_itemId=7

You'll need to change the url to fit your needs and change the g2_itemId to the album itemid that contains the albums or photos which the GPS custom field is set to GPS coordinates.

If you use the theme, goto site admin, themes. Click on the tab called map. Enter your api key into the appropriate field. Then you just need to change the theme for that album to the google map theme.

 
Termitenshort
Termitenshort's picture

Joined: 2005-10-09
Posts: 1894
Posted: Tue, 2005-10-11 20:09
samkuhn2 wrote:
Run on install would be fine, although in that case you could just run it before distributing the package. I think more clever would be to run on demand so that a user can choose an arbitrary character/color/pin graphic. It would create a lot of small pngs just to cover common letters+symbols+colors+graphics for the most common languages. For an exhaustive library for all languages would be unachievable considering that UTF8 includes 2^16 chars. If the module is going to generate all the pngs on install, I would suggest it do that based on the installed languages in that Gallery.

I don't really understand how language specific font sets or symbols are handled by Gallery. It uses UTF8, but beyond that I am useless.

So ok, I believe that the best would be to have an update to the Admin panel so you could "regenerate" the icon at will with different character set or sizes or colors ....

I'm gonna start working on this, it seems quite interesting to do :-)

HorsePunchKid: is it ok if I modify the code and create a new version with this included ? (like a 0.2.1 or something)

Let me know, I'm gonna get that started on my homework time :-)

 
leperm

Joined: 2005-10-11
Posts: 4
Posted: Tue, 2005-10-11 20:23

Thanks for your help. Sitll running into problems, it was from the map theme I was using. I enter the correct key and it insists it is incorrect. If I only use the module it works..in the sense it displays a map. It does not however display a marker and I have entered GPS co-ords. A "broken" marker image appears for a fraction of a second and the correct co-ords then disappears.

Dam
http://beyondajoke.net/main.php?g2_view=map.ShowMap to see what i mean