Geotag your WordPress posts

If you’d like to geotag you WordPress posts you can do so using my Technotags plugin. The plugin does two things. It allows you to add metadata to your posts including geotag coordinates and it automatically creates a link to Google Maps to show the location of your coordinates.

Get the latest version of the plugin here.

To use this geotagging goodness simply add a custom field key called ‘gmap’ to your post and enter the latitude and longitude in decimal format as the value. Coordinates must be in decimal formal e.g. 52.4509934727,-1.93881244894 rather than as degrees, minutes and seconds e.g. +52° 27′ 3.57", -1° 56′ 19.72" for this to work. Most if not all GPS devices will give you coordinates in decimal format.

The custom fields from an example geotagged post will look like this…

WordPress Custom Fields

Your post is now geotagged! By adding coordinates to your post’s metadata you will be future-proofing your geotags because any future applications that can use latitude and longitude data will be able to extract these without affecting the post itself.

To help your readers visualise the location specified by your geotag coordinates the Technotags plugin creates an link to Google Maps using your coordinates at the end of your post. Because you entered coordinates using custom fields, the Google Map link is separate to your post, like all good metadata should be.

The Technotags plugin does other cool things like create links to Flickr and Technorati tags and much more. Check it out!

Have fun and let me know how you get on. Happy geotagging!

15 thoughts on “Geotag your WordPress posts”

  1. Hi! Thanks for the instructions!

    I have some additional ideas – actually two things:

    1) It would be great to have a way to set the location with the xml-rpc interface, or some other method that can easily be added to desktop software. I want to tell my computer where I am and I want it to tell my blog about it. Because I might have a GPS, or I might be using plazes.com etc.. so I want to do some scripts or such for the desktop to do this automatically and open my blog when it has been set. Maybe there is even a way to set geolocation via the blogging API?

    2) Geotags should really be published as part of the blog feeds. This would be really awesome, as if you are familiar with the “planet” concept (try http://planet.gnome.org for example) – one could plot a map of all the syndicated persons.. quite cool imho. Also other interesting stuff might be possible. Anyway, there’s some draft of the format here: http://www.w3.org/2003/01/geo/

    Thanks for the work!

    //Tuomas

  2. Hi Toumas

    Thanks for your comments. Here are my initial thoughts:

    1. Do you mean set the geo location via XML-RPC for individual posts? If you are using a desktop editor to write posts then ideally I think they should support WordPress custom fields. You can then add your coordinates when you write your post, or any time afterwards if you update your post’s metadata. I think it’s important to keep the geo coordinates as metadata and not mix them up with the post text. In that way coordinates are always available to other applications…

    …which brings us nicely to your second question…

    2. Yes I think you’re spot on with this suggestion. Right now my plugin appends your geo coordinates to the end of your post (remembering that in the database the coordinates are separate from the post text itself). What I think you’re asking for is to add coordinates as a data element in the feed? So for example you’d have something like: <title> <description> <link> <geo:lat> <geo:long>. That sounds like it should be possible using the WordPress API…

  3. Yeah, the ability to add the geotags in feeds would rock. I wonder if there already is something like this. But it’s quite natural, that if you tag posts with geo-location, to also supply them in the feed, so rss readers etc could take advantage of it.

    I agree custom fields are just like “tags” anyway – but it would be good if different blog software supported a common set, so that the blogging tools could support this feature for all blogs.

    //T

  4. Useful.
    I’m collecting infos on geotagging on http://www.geotag.it and i’ve linked this page.
    I would just add to the conversation that geocoding is an important way of geotagging, but not the only.
    I began tagging with my own software italian lawyers, by tags, keys, categories (as you want to call them).
    I’m sharing the same solutions on geotagging, finding standards.
    Even if geocoding is important to describe a point on the world, there are also regions, metaregions, local words for local activities very useful for travellers.
    So my question: to describe something more than coordinates, there are common standards ?
    I’ve seen some of them on flick, youtube, techonorati, but at the moment i feel there are many solutions but none most used over the others.
    Sorry for my english, i’m Italian.
    Spataro

  5. Hi Spataro

    Thanks for your comment. There has been a rapid uptake of tagging in recent years but we’re not seeing many standards emerging. What needs to happen I think is for a number of the main tagging services to get together to look for ways of standardising the services they offer.

    There is always of course the semantic web project. The Resource Description Framework (RDF) was created to do some of the things you describe and is starting to make progress. But RDF needs to be easier to implement and more widely used.

    See http://www.w3.org/2001/sw/

  6. Can this be made to work with ‘postie’ or even the built in post by email? Reason is that I have a PDA phone with built in GPS/Camera, using MMS (fancy text nessages) I can email a photo with the co-ordinates.

    I used to use the ‘coordinates’ plugin but that used a centrally hosted CGI script whhich has died

  7. Graham, that’s very interesting, how are the coordinates incorporated when you send a GPS tagged picture via email? The Technotags plugin would need to be able pull out coordinates. Are then copied to the text of the email or as EXIF data in the picture itself?

  8. Hi
    So what I have done in the past is simply insert the GPS co-ordinates into the text of an MMS or email template I keep in my drafts folder. The photo is then attached, or if MMS I can trigger the camera from within the message editor.

    So in summary it all looks like a standard email with photo and then in the text of the email the GPS co-ordinates were preceded by a coding.

    The old plugin I had then simply saw them on page render and marked up the co-ordinates to a mapquest URL.

    No exif headers in the phot, but thats a nice idea!

  9. I like this David. It seems to work very well. I may tweak how it is presented but it looks like it will do the job for me on my geognomes.com site. Thanks!

  10. I couldn’t understand some parts of this article , but I guess I just need to check some more resources regarding this, because it sounds interesting.

  11. It would be very cool if a geotagged photo were attached to a post if your plug-in could grab the coordinates from them. Even cooler if a map link could be placed beside each photo to display their location.

Comments are closed.