The thing I like about Textpattern is that it has a small and neat footprint (without a lot of code bloat), is transparent to use and just feels very intuitive compared to other CMS’s I’ve tried.
However, this has it’s downside in the fact that you almost get a bare bones installation and to do stuff, you have to get out there and find out how. When it boils down to it though, this is generally not a problem and if you are of the inquiring mind type, it can be quite enjoyable.
What brought on this particular avenue of pleasure, is this challenge from Bruce to deliver a georss feed.georss Did I need one? Maybe not, but I just had to have one under the circumstances.
A by-product of the consequent rootling through code, has been the sorting-out of my feed. Textpattern comes with basic Atom and RSS feeds, but they do not have the required elements for, say georss or podcasting. Long have I been chastised for incorrectly entering a feed image into the Site slogan field of Txp, where only text should appear – it worked, but it wasn’t right by the standards, and I quite agree, there should be standards!RSS 2.0 Specification So, I set out to find out how to either a) modify the existing rss.php file to the georss format, or b) create a new feed for the purpose.
Scratching the surface, it was easy to add the required xmlns:georss="http://www.georss.org/georss" to the rss.php file, but I found linking the Custom fields for the required georss:point coordinates more tricky. Looking further, I tried the feed altering plugin jnm_feed_custom_item by Juanjo Navarro, but that placed the georss:point information within the <![CDATA[ of the feed. Incorrect and unreadable by Google Map javascript.
A quick google led me to this article about Textpattern podcasting, which drew it’s base from a simple plugin called mg_setheader by the same author, Michael Gravel. Follow this and you’ll be 90% there.mg_setheader
Bruce’s geo feedOnce you’ve sorted out what you require in your desired feed (pull apart someone else’s feed) it’s a fairly simple task to create a new Section, Page and Form which will become your own. The articles I have linked here cover the basics and you can look at my
feed for yourself. There’s nothing clever (apart from Mike’s plugin) here, apart from a twist on making it work to my satisfaction and in a way I wanted, in this particular instance. My page code is set out below:
<txp:mg_setheader value="application/rss+xml" /><?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:georss="http://www.georss.org/georss">
<channel>
<title>spotthehall-geo</title>
<link>http://spotthehall.com</link>
<atom:link href="http://spotthehall.com/georss" rel="self" type="application/rss+xml" />
<description>a feed designed for incorporation in Google Map overlays</description>
<language>en</language>
<copyright>℗ & © 2007 onwards by David Hall</copyright>
<image>
<title>spotthehall-geo</title>
<url>http://spotthehall.com/images/gravatar.png</url>
<link>http://spotthehall.com</link>
<width>80</width>
<height>80</height>
<description>spotthehall-geo</description>
</image>
<txp:article_custom form="georss" limit="999" section="article" />
</channel>
</rss>
Because I feed my map from Txp’s Custom fields, these are available for use elsewhere. I don’t provide an excerpted feed, I’m of the opinion that as I would like to read an article in my newsreader (Mail), I will do the same for others. Now, that poses a problem in passing the body of an article in the georss feed – the resultant popup window in someone’s map overlay will be huge! Putting in an <txp:excerpt /> tag will produce nothing, so this is where the Custom fields come in.
This is as part of the Txp Form recommended for placing the body of the article in the feed:
<![CDATA[<txp:body />]]>
and this is what I have done (placing the text after the image prevents the image from breaking out of the map overlay boundary box):
<![CDATA[<p><img src="http://spotthehall.com/<txp:custom_field name="img" />" alt="" /></p><p><txp:custom_field name="txt" /></p>]]>
You can put in there whatever you want really and using the Custom fields picks it up on a per article basis of course.
Since working this out I’ve found another example worth looking at by Isaac Bowen, Custom RSS Feeds worth looking at and interesting that he’s subsequently also found the mg_setheader plugin.
Bruce and I are now happily posting each other’s georss feeds on our respective maps – how long will we put up with the Cuckoo in the nest – who knows… Probably until one of us swamps the others map with blue markers (which at present we can’t see a way of altering to something more appropriate) and throws the Cuckoo out of the pram (don’t you love mixing metaphors)
An upshot of all this is that I’ve actually reactivated my Feedburner account created a new combined feed, to take over as the main feed, with all it’s attendant bells and whistles. Why reinvent the wheel I thought, and I can make-up specialist feeds, is/as/when required. (Both are running side-by-side at present, but I’ll turn of the basic one soon.)
Prompted by Bruce’s comments and his mapping article, I initiated another step in the evolution of my map
There is a very clear example on GoogleMaps, which slots in nicely, only requiring slight modification if you want to run more than one set of feed imported markers.
The following is the code I used to import my Scottish Isles flight photographs from Picasa – using the kml feed (see screenshot below), so that I get the images on my map – subsequently moved over to the other place – more apt over there
var geoXml;
geoXmlPicasa = new GGeoXml("http://picasaweb.google.com/data/feed/base/user/spotthehall/albumid/5206552168586205041?alt=kml&kind=photo&hl=en_GB");
map.addOverlay(geoXmlPicasa);

Now, having given it a little thought as to what I would like to actually have cluttering my map up with, I decided that as I intend to use Flickr mainly for any geotagged photos emailed directly from my iPhone, they should take precedence. Also having one eye on the future – with the new generation iPhone having built in GPS and exif data. Flickr may be set to detect and automatically map the uploaded photos, which then in turn will appear, not only on the Flickr map, but here as well.
I think that is about as far as external overlaying of markers I can see myself stretching to, but you never know, so the code is set up cater for more than one set of feeds.
This is the starting point from the Google example:
geoXml = new GGeoXml("http://api.flickr.com/services/feeds/geo/?g=322338@N20&lang=en-us&format=feed-georss");
map.addOverlay(geoXml);
and this is my Flickr import, using markers rather than thumnail-markers:
var geoXml;
geoXmlFlickr = new GGeoXml("http://api.flickr.com/services/feeds/geo/?id=40178719@N00&lang=en-us&format=rss_200");
map.addOverlay(geoXmlFlickr);
from here:

along with the toggling code (added at the end of the script):
function toggleMyKml() {
if (toggleState == 1) {
map.removeOverlay(geoXmlFlickr);
toggleState = 0;
} else {
map.addOverlay(geoXmlFlickr);
toggleState = 1;
}
}
and the html from the body of the map page to show a checkbox (this runs similarly with the previously written checkboxes that govern the internal markers):
<input type="checkbox" id="iphoneCheckbox" onClick="toggleMyKml(geoXmlFlickr);" checked="checked"/><label for="iphoneCheckbox"><img src="images/470.png" alt="" title="Flickr-iPhone" /></label>

Alternatively, you may use buttons to toggle on and off the markers (although this does not indicate the on or off state on the button) using this from the Picasa installation:
<input type="button" value="Isles Flight" onClick="toggleMyKml(geoXmlPicasa);"/>
resulting in these buttons:

Or to be more precise – toggling marker group types on my map – a big thank you here has to go to Art Zoller Wagner here, for picking-up my Geoblogging code and working on the switching on and of of the various groups represented on the map.
This is based upon this example which uses API v2 Latest (v=2.x): 2.77 Google code and is loaded with //<![CDATA[ which is transposed to the AJAX API Loader and requires slightly more work to enable it to be used with the icn Custom field I use.
In the process of doing this exercise, the requirement for the redundant first icon case has been eliminated, so there is no longer the need to provide for the ‘0’ instance, old code:
var markerIcon = new GIcon();
markerIcon.image = “images/none.png”;
markerIcon.shadow = “images/noshadow.png”;
markerIcon.iconSize = new GSize(12, 20);
markerIcon.shadowSize = new GSize(22, 40);
markerIcon.iconAnchor = new GPoint(12, 40);
markerIcon.infoWindowAnchor = new GPoint(12, 15);
var blueIcon = new GIcon();
blueIcon.image = “images/blue.png”;
blueIcon.shadow = “images/shadow.png”;
blueIcon.iconSize = new GSize(12, 20);
blueIcon.shadowSize = new GSize(22, 20);
blueIcon.iconAnchor = new GPoint(12, 40);
blueIcon.infoWindowAnchor = new GPoint(12, 15);
var greenIcon = new GIcon();
greenIcon.image = “images/green.png”;
greenIcon.shadow = “images/shadow.png”;
greenIcon.iconSize = new GSize(12, 20);
greenIcon.shadowSize = new GSize(22, 20);
greenIcon.iconAnchor = new GPoint(12, 40);
greenIcon.infoWindowAnchor = new GPoint(12, 15);
var myIcon = [markerIcon,blueIcon,greenIcon];
the new:
var blueIcon = new GIcon();
blueIcon.image = “images/blue.png”;
blueIcon.shadow = “images/shadow.png”;
blueIcon.iconSize = new GSize(12, 20);
blueIcon.shadowSize = new GSize(22, 20);
blueIcon.iconAnchor = new GPoint(12, 40);
blueIcon.infoWindowAnchor = new GPoint(12, 15);
var greenIcon = new GIcon();
greenIcon.image = “images/green.png”;
greenIcon.shadow = “images/shadow.png”;
greenIcon.iconSize = new GSize(12, 20);
greenIcon.shadowSize = new GSize(22, 20);
greenIcon.iconAnchor = new GPoint(12, 40);
greenIcon.infoWindowAnchor = new GPoint(12, 15);
var myIcon = [];
myIcon[“1”] = blueIcon;
myIcon[“2”] = greenIcon;
markerGroups = {“1”: [], “2”: []};
Art’s code passes the icon information as a doc_type Custom field with a group description, mine goes as an icn Custom field with a numerical value. This has implications for the handling of the marker groups within the code itself and can easily confuse, and it don’t work! Choose either method, but as I have already set-up my Custom field for icn, I have now changed the following two lines in my code, from:
function createMarker(point,name,html,icn) {
var marker = new google.maps.Marker(point,myIcon[icn]);
to:
function createMarker(point,label,html,group) {
var marker = new google.maps.Marker(point,myIcon[group]);
and added this line next:
markerGroups[group].push(marker);
so, the actual extraction of the information from the xml document still uses:
var icn = markers[i].getAttribute("icn");
At the end of the map javascript, just after this line:
google.setOnLoadCallback(initialize);
add the following, which sets-up the checkboxes to turn on and off the markers on your page:
function toggleGroup(type) {
for (var i = 0; i < markerGroups[type].length; i++) {
var marker = markerGroups[type][i];
if (marker.isHidden()) {
marker.show();
} else {
marker.hide();
}
}
}
The basic code within your html for the checkboxes is:
<form name="marker_checkbox" action="#">
<input type="checkbox" id="blueCheckbox" onclick="toggleGroup('1')" checked="checked" /><label for="blueCheckbox">Blue</label>
<input type="checkbox" id="greenCheckbox" onclick="toggleGroup('2')" checked="checked" /><label for="greenCheckbox">Green</label>
</form>
I will upload an alternative complete file with a skeleton of this code linked to (and clearly identified as such) from my Geoblogging page in due course, and if Art wants to link his map page in the comments (over to you Art) also hop over there to see what he’s up to with radio buttons and the like
EDIT: 20:59 21 Sept. 08 – slimmed the code down slightly and new download file has been updated.
My map has made a comeback after a spell of absence. Initially, this
indicated a link to a point my map, then I changed it to linking out to GoogleMaps. However, I want my cake and eat it as well.
Now, when an article has said icon in the side column, it will link to my map and the bottom-left Google logo in my map (of course) links to that area in Google Maps, but it is joined by a new iPhone icon
which links to the same point on an iPhone. I’ve done this because the usual Google maps don’t function in iPhones like they do here, so there are a new set of co-ordinates that direct the iPhone’s inbuilt GMap to that point.
But that’s not all! Welcome another icon
this will be seen primarily in the Photos section, where it signifies a link to a Picasa map which has photographs geolocated on it. I may also use this to signify a general overview link to my map, such as this
rather than introduce a fourth colour (but I could change my mind on this).
As you will see (if you click on the second green icon) I have introduced polylines into my map. These will be used to follow routes, with or without markers, this one is centred on the flight I took in Namibia, from Swakopmund over the Sand Sea.
It’s been blowing blizzards through all day here, following on from the wet of recent days, not good for the newly born lambs that are popping out now. On a nearby relation’s farm, they’ve had quintuplets.
The site is pretty well up and running again, now all written using TextPattern but it actually started out as an uberdose Wordress theme called Zero – just found it easier to create the extra pages and features needed in TxP.
Anyway, enough of that. I heard about another new animal today that is on the verge of extinction, the Saiga. Yes, I know there are probably literally millions of species that I haven’t heard of (and some even that nobody knows of) that are on the verge of extinction, but this little fella is actually a reasonable size – big enough to eat in fact – and that’s been half his problem.

Apparently there had been protection of little known species by the old USSR, but since it’s collapse this protection ended and the combined ills of poverty and demand for Saiga horn in traditional Chinese medicine, has led to the state it finds itself in now having suffered a 96% crash in it’s population.
Not the prettiest of creatures you may say, reminds me of some alien types from films (I’m sure they get their inspiration from nature, I know H.R. Gieger does) with this specially adapted flexible nose to filter dust in summer and warm air in winter. However, just because it doesn’t have the high profile ‘pull’ of Lion or Elephant, is not to say that it doesn’t have an important part to lay within it’s ecosystem and contribution to the wealth of the natural world.
Many creatures are in danger of slipping though the net and away from us altogether and that’s why I support the FFI – where I heard about the Saiga – as they champion equally unglamorous or obscure species in accordance with the Convention on Biological Diversity. I think he deserves a bit of help.