WordPress.org

Ready to get started?Download WordPress

Forums

Comprehensive Google Map Plugin
Shortcode to automatically display images on a google map (16 posts)

  1. JoStockton
    Member
    Posted 2 years ago #

    Hi,

    First I would like to thank you for this great plugin. It is the best of this kind I found. Complete, easy to use and easy to hack, it rocks!

    I was looking for a plugin displaying automatically images of a post inside an embedded Google map according to their exif location. Unfortunately, I didn't find one (I didn't wanted to use custom fields, or special gallery). Then I found your plugin, and thought it will be easy to extend with my limited skills.

    And this is what I want to share with everyone.

    The result is quite easy to use, you just have to had the shortcode [autoimage] and the map displays the locations of all the images linked to your post. You can use all the options of the original plugin, as all it does is to extract exif locations of images, then to give them to the original plugin.

    Example: http://img703.imageshack.us/img703/7408/autoimage1.png

    To do this, I created a new plugin "cgmp-autoimage" (not available on wordpress.org). It is 2 small files:

    * cgmp-autoimage.php http://pastebin.com/NDt0ycdU
    * shortcode.php http://pastebin.com/XrjfQTiH
    I wanted to add route between the markers but can't figure how.

    I also wanted to customize the bubble to look like this: http://img823.imageshack.us/img823/6121/autoimage2.png

    So I had to modify your own code like this (based on 7.0.27):

    * functions.php http://pastebin.com/qDApQk8p (to add new wiki patterns)
    * cgmp.framework.js http://pastebin.com/Byp6wK21 (change bubble size and remove directions).

    I have not the skills, nor the time to maintain my code, so I give it to Alexander Zagniotov. You can do whatever you want with it.

    Thank you

    http://wordpress.org/extend/plugins/comprehensive-google-map-plugin/

  2. alexanderzagniotov
    Member
    Plugin Author

    Posted 2 years ago #

    Looks interesting. I will definitely look into what you did once I am in US.

    Regards

  3. alexanderzagniotov
    Member
    Plugin Author

    Posted 2 years ago #

    Actually, i gave it a second more thorough look - this is great! Thanks!

  4. alexanderzagniotov
    Member
    Plugin Author

    Posted 1 year ago #

    JoStockton...

    I want to apologize - I have been busy with relocation and did not have a chance to incorporate your changes yet :/

    I have not forgotten your efforts.

  5. JoStockton
    Member
    Posted 1 year ago #

    This is not a problem, take your time with your relocation :)

  6. alexanderzagniotov
    Member
    Plugin Author

    Posted 1 year ago #

    Your change will be the next todo for me

  7. oddcopter
    Member
    Posted 1 year ago #

    It would be nice to be able to enter or edit the location of an image. Maybe that is already possible. I am looking for an easy way to display pics submitted from all over the world on a map and have them popup when clicked.

  8. alexanderzagniotov
    Member
    Plugin Author

    Posted 1 year ago #

    @JoStockton,

    I was looking at your logic today and tried to spike it by merging in with my plugin. I am having trouble finding the images that would provide me with exif GPS information, just like you have in your paste:
    http://pastebin.com/XrjfQTiH

    I have tried different pictures from digital cameras, and one GPS enabled digital camera, the exif metadata in my case never contained "GPS..." keys. It did however contain a bunch of other metadata

    When you took your pics, did you use any specific camera with any specific settings/abilities?

    I want to provide very clear instructions to users that explain when should they use this feature.

    Thank you

  9. oddcopter
    Member
    Posted 1 year ago #

    I was researching this and found that you can easily add the gps data in the free google picture editor Picassa.

  10. JoStockton
    Member
    Posted 1 year ago #

    @alexanderzagniotov

    I did nothing nor use specific settings, I just took shoots with my camera with GPS enabled. It's a Sony HX9V.

    After reading your post, I tried with my phone, and indeed that doesn't work. Seems there is no standard for storing location in pictures. I'll try to make this work with my phone, maybe this will give us clues.

  11. oddcopter
    Member
    Posted 1 year ago #

    @JoStockton and @alexanderzagniotov

    I believe it is standard and Picassa is a great tool to see the exif data. I just took a pic with my iPhone with GPS enabled and the location shows up in two fields "GPS Latitude" and "GPS Longitude".

    The nice thing about Picassa being a Google App is that if a picture has no GPS data in the exif, you can just drag the pic to a map within Picassa and it will add the coordinates into those two fields.

    Also, here is a wiki on the formatting of the data within the exif:

    http://en.wikipedia.org/wiki/Geotagging#Geotagging_photos

    Thanks for your work on this. I would like to add this functionality to my blog.

  12. JoStockton
    Member
    Posted 1 year ago #

    I figured out the problem with my phone (Galaxy S2 with Cyanogenmod 9), the location was already computed, and stored in $exif["GPSLatitude"][0] and $exif["GPSLongitude"][0]. The other entries $exif["GPSLatitude"][1] etc. are empty.

    I made this patch : http://pastebin.com/Ut6efk8k and my code works with photos from my phone.

    But this is ugly, as it won't work if $exif["GPSLongitude"][1] (or the others) equals 0 for legit reason. This is unlikely, but we never know.

  13. oddcopter
    Member
    Posted 1 year ago #

    @JoStockton

    I was trying to get your code up and running, but the cheap shared hosting I have runs php 5.2.9 so this line doesn't work
    $date=date_create_from_format('Y:m:d H:i:s', $img['date']);

    Any ideas on making it work for 5.2.9?

    Thanks, I realize you don't want to support this, but any help is appreciated.

  14. JoStockton
    Member
    Posted 1 year ago #

    @oddcopter Try to Replace

    $date=date_create_from_format('Y:m:d H:i:s', $img['date']);
    $list_coord_gps.="#-".date_format($date,'d/m/Y H:i:s');

    with

    $informat = '%Y:%m:%d %H:%M:%S';
    $ftime = strptime($img['date'],$informat);
    $unxTimestamp = mktime(
            $ftime['tm_hour'],
            $ftime['tm_min'],
            $ftime['tm_sec'],
            1,
            $ftime['tm_yday'] + 1,
            $ftime['tm_year'] + 1900
    );
    
    $date=date('d/m/Y H:i:s',$unxTimestamp);
    $list_coord_gps.="#-".$date;

    Edit : I'm french this is why I format the date d/m/Y. Change it as you want.
    Edit2 : this portion of code should work with php 5.1 or greater. All methods are PHP4/PHP5, except strptime PHP 5.1.

  15. JoStockton
    Member
    Posted 1 year ago #

    Using date and time formats set in wordpress is better. Replace

    $list_coord_gps.="#-".date_format($date,'d/m/Y H:i:s');

    with

    $date=date_i18n( get_option('date_format')." ".get_option('time_format'), date_timestamp_get($date));
    $list_coord_gps.="#-".$date;

    @oddcopter replace

    $date=date('d/m/Y H:i:s',$unxTimestamp);

    with

    $date=date_i18n( get_option('date_format')." ".get_option('time_format'), $unxTimestamp);
  16. oddcopter
    Member
    Posted 1 year ago #

    @JoStockton

    Thank you very much!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic