WordPress.org

Plugin Directory

wiki:GeoPlugin

Geo Plugin

The Geo plugin allows you to attach geographic coordinate information to posts. It also lets you specify a default geographic location for your entire WordPress blog.

If you upgraded your WordPress 1.2 installation to a WordPress 1.5 installation, you'll be happy to know that the Geo plugin will upgrade your location data so that your old data is preserved.

Installation

Installing the Geo plugin is simple:

  1. Download the latest Geo archive.
  2. Extract the files from the archive.
  3. Upload the geo.php file to your wp-content/plugins directory.
  4. In the WordPress Admin Panel, activate the Geo plugin on the Plugins tab.
  5. Visit the Options | Geo Info tab to configure the plugin.

Using the Geo Plugin

Configuration

The Geo plugin provides some configuration options for posting location information on your blog.

Plugin Options

Geographic Tracking Features
Checking this option enables geographic location features on your blog. This must be checked if you want !WordPress to automatically include geo information.
When no location is specified
This option tells Geo what to do when you provide no coordinates for a post. You can either output no information or output a default setting, as specified in the Latitude and Longitude boxes that follow this option.

Preset Locations

Geo will keep a list of locations that you specify so that you can select one using a dropdown on the post editing page rather than remembering coordinates for specific places.

To add a new location to the table, specify the name, latitude, and longitude in the New Location row, then click the Add/Update Locations button. Your new location will appear in the table and will be available immediately from the dropdown on the post editing page. Coordinates are added in decimal degrees, identical to that used by Google Maps.

Change a location's coordinates by editing them directly in the table, then clicking the Add/Update Locations button.

Delete a location entirely by clicking the Delete link. You will need to confirm this selection before it is committed.

Attaching Coordinates to Posts

The form fields to attach coordinate information to posts only appear on the Advanced Editing page. This page appears when editing a previously written post or by clicking the Advanced button on the standard post-writing page.

The available fields allow you to directly specify a Latitude and Longitude for the post. Coordinates are added in decimal degrees, identical to that used by Google Maps. You may also choose an option from the Preset Locations dropdown to set the Latitude and Longitude boxes to their appropriate values.

Displaying Geo Information

When the plugin is enabled and Geographic Tracking is turned on, the Geo plugin will automatically add approriate meta tags to the head section of your blog containing the geographic information.

You may wish to use the coordinate information in your blog directly for other means (displaying a map, for example). A variety of coordinate-specific functions become available when the plugin is installed.

These functions are only valid in the context of "The Loop". Outside "The Loop" the longitude and latitude values of a post are unavailable.

get_Lat()
Returns the Latitude value associated with a post.
get_Lon()
Returns the Longitude value associated with a post.
the_Lat()
Outputs the Latitude value associated with a post.
the_Lon()
Outputs the Longitude value associated with a post.
geo_PopUpScript()
Outputs a javascript routine used by UrlPopNav(?)() to popup a URL in a new window.
geo_UrlPopNav()
Creates a dropdown containsing a list of sites that are coordinate-sensitive. Choose an item from the dropdown to visit that site with the latitude and longitude values specified for the post.
longitude_invalid()
Returns true if the Longitude for the post is outside of the acceptible range.
the_AcmeMap_Url()
Outputs a URL to the Acme Mapper for the post coordinates.
the_GeoURL_Url()
Outputs a URL to GeoURL for the post coordinates.
the_GeoCache_Url()
Outputs a URL to GeoCache(?) for the post coordinates.
the_MapQuest_Url()
Outputs a URL to MapQuest(?) for the post coordinates.
the_SideBit_Url()
Outputs a URL to SideBit(?) for the post coordinates.
the_DegreeConfluence_Url()
Outputs a URL to Degree Confluence for the post coordinates.
the_TopoZone_Url()
Outputs a URL to TopoZone(?) for the post coordinates.
the_FindU_Url()
Outputs a URL to FindU for the post coordinates.
the_MapTech_Url()
Outputs a URL to MapTech(?) for the post coordinates.
the_GoogleMap_Url()
Outputs a URL to Google Maps(?) for the post coordinates.
geo_distance($lat1, $lon1, $lat2, $lon2, $unit='m')
Outputs the number of miles, kilometers, or nautical miles from lat1/lon1 to lat2/lon2. Use with get_Lat()/get_Lon() to determine the distance from the current post to a set point.
get_place_name($lat, $lon)
Takes a pair of coordinates and returns the associated name, if one exists. Used mainly by other functions.
the_location($format, $defaultlocation, $service)
Returns the location of a particular post with its placename as a link to a mapping service (default is GoogleMaps). Default behaivior also displays degrees after link; this can be turned off by using the_location('<a href="%4$s">%1$s</a>'). Note that $defaultlocation does not override admin panel settings but is instead a failsafe in case they aren't set.

Troubleshooting

No notes currently.

Check the ticket reports for entries on the Geo component.

Last modified 8 years ago Last modified on 04/06/06 22:19:29