bsuite_geocode Plugin For WordPress

I’m a big fan of the WP Geo plugin, but I want more.

My biggest complaint is that I want to insert coordinates using Google Maps or MultiMap URLs, rather than insert them in the modified story editor. So I wrote a bit of code that reads through the URLs in a post, finds the “maps.google” or “multimap.com” URLs, fishes the latitude and longitude out of them, and adds some geocoding tags to the body of the post.

Take a look at how it works with these posts in my archive…

You should see one or more blocks of links like the following (from my Osceola Weekend post):

geolocation: geo:lat=44.006336, geo:lon=-71.547260, geotagged, geolocation:44.006336,-71.547260 geobloggers

Go ahead and click the “geobloggers” link. I could have added these links using the old Geo plugin, but I still would have had to insert the coordinates separately. Actually, that brings up a good point: my code also inserts post metadata in the same format the Geo plugin uses, so I can take advantage of all the good functions it has, like the one that inserts the “<meta name=“ICBM” content=“44.006336, -71.547260” />” tag in the header of this post (caveat: I had to disable the add_action code in Geo that feeds the postmeta table, as it was conflicting my code).

I’m releasing this now, to start some public discussion, but please recognize that it’s a very early beta.

Download: bsuite_geocode.zip

Install: place unzipped “bsuite_geocode.php” file in your wp-content/plugins folder and activate it via the WP control panel. See the WordPress Codex for more detail.

Use: write posts as usual, adding links to Google Maps or MultiMap as appropriate. Links to those sites that have latitude and longitude components will be used to geocode the post.

Example of a working URL:

http://maps.google.com/maps?ll=19.355507,-155.072365&spn=.191780,.318003&t=k&hl=en

Example of a URL that won’t work (note how there’s no “ll=”):

http://maps.google.com/maps?q=decker+canyon+rd,+malibu+california&spn=0.019857,0.039750&hl=en

I’ve got a lot of features and uses in mind, so consider this only a start. Please post bugs and suggestions in the comments.

Also, see these previous posts on geolocating the news or geolocating everything or just search the archives to understand why I’m so excited about things like this.