[OpenLayers-Users] Display geotagged photos in OpenLayers

Franz Buchinger fbuchinger at gmail.com
Tue Aug 16 09:08:40 EDT 2011


If you want to have more control over your popups, its better to create a
vector layer with a passed in text format instead of a text layer:

var photos = new OpenLayers.Layer.Vector("Photo Layer", {
    strategies: [new OpenLayers.Strategy.Fixed()],
    protocol: new OpenLayers.Protocol.HTTP({
        url: "photos.txt",
        format: new OpenLayers.Format.Text()
    })
});

You can combine this layer with a featureSelect control and open a popup of
your choice, as demonstrated in the sundials example:
http://openlayers.org/dev/examples/sundials.html.
Of course, this approach sacrifices the simplicity of the text layer, but
allows you to customize any aspect of your features and popups.

Franz

2011/8/16 Hendrik Oesterlin <hendrikmail2002 at yahoo.de>

> "Franz Buchinger" fbuchinger at gmail.com wrote on 16/08/2011 at 21:17:11
> +1100
> subject "[OpenLayers-Users] Display geotagged photos in OpenLayers" :
>
> Thank you very much for your reply!
>
> > first of all, you probably want to generate thumbnails of your photos and
> > load these into the map instead of the large-size images you are using
> now.
> > This gives you a much better performance.
>
> Yes, this is very easy to do. Shrink the jpg instead of setting only
> the pixel dimensions.
>
> > The popup can then contain a link
> > to the full-res version of the photo.
>
> How can the pop up size be defined?
>
> > Extracting EXIF/GPS metadata from JPEG images in Javascript is possible,
> but
> > quite hacky and out of OpenLayers' scope. There is a Javascript library
> of
> > Jacob Seidelin that does that (
> > http://blog.nihilogic.dk/2008/05/reading-exif-data-with-javascript.html
> ),
> > but it comes with the downside that you have to download all hi-res
> versions
> > of the photos to the browser in order to get the gps coordinates
> contained
> > in the exif metadata.
>
> > A better approach would be to dump out the GPS coordinates of the photos
> > into a JSON file, and load that file into OpenLayers with an AJAX
> request.
> > You can then specify an Openlayers.Format that parses this information
> and
> > creates a feature for each of your photo.
>
> As I am not a web designer, and I am not familiar enough with
> JavaScript, JSON and AJAX this is not easy to achieve for me...
>
> > You can use the exiftool command line utility (
> > http://www.sno.phy.queensu.ca/~phil/exiftool/) to quickly dump out all
> GPS
> > coordinates into a JSON structure, see the reading examples page (
> >
> http://www.sno.phy.queensu.ca/~phil/exiftool/exiftool_pod.html#reading_examples
> )
> > for more information.
>
> Thank you for this tool! extracting lat/lon is easy with it and I will
> be able to create the text file for use with the
>
> var Photos = new
> OpenLayers.Layer.Text("Photos",{location:"data/photos.txt", projection:
> epsg4326});
> map.addLayer(Photos);
>
> code.
>
> My remaining problem is to enlarge the pop up size big enough to fit
> the photo in it.
>
> An "X" to close the pop up would be handy too.
>
> --
> Sincerely
> Hendrik Oesterlin - email hendrikmail2002 at yahoo.de
>
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20110816/bb70170a/attachment-0001.html


More information about the Users mailing list