by Matt Davis

An admin side plugin for Textpattern which gives the ability to associate location data with an article.

Update: A new, simplified version, supporting the latest Google Maps API is also available for download.. Instead of a map right on the Write tab there is a link to a “popup” map.

Using Expanding on a hack developed by duchamp I threw together this plugin which adds a Google map to the Textpattern write tab allowing you to easily add location data (latitude and longitude) to your article. Includes finding latitude and longitude coordinates for an address using Google’s geocoding service.

More information is available at the forum post

Download msd_google_map

Once you’ve added location data to your articles you can use this data in an unlimited number of ways. Map your articles or add a map to each article.

To use

Install and activate.

This plugin will add a google map to your article tab to assist you with adding lat/lng coordinates to the 2 custom fields. Just click on the desired point on the map to set the location or enter an address in the address field.

You must set the Google Maps api key for your domain in the Article Location tab where you can change other options including custom fields used, map type, map control type, and marker color and size. An api key can be obtained at Google Maps

Usage Example

An example of how you can use your article location data is with Google’s Static Map API to display static image map. Here is the code used to display a map.

<p>Location:<a href="<txp:custom_field name="lat" />,<txp:custom_field name="long" />&t=h&z=17"><img class="frameleft2"
src="<txp:custom_field name="lat" />,<txp:custom_field name="long" />&zoom=14&size=580x200&maptype=<txp:variable name="map_type"/>&markers=<txp:custom_field name="lat" />,<txp:custom_field name="long" />,green&key=MY-API-KEY&sensor=false" alt="map" /></a></p>

Commenting is closed for this article.