Changeset 645


Ignore:
Timestamp:
Sep 2, 2008, 9:39:06 PM (11 years ago)
Author:
Nick Burch
Message:

Improve the RSS feed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/npemap.org.uk/perllib/NPEMap/Postcodes.pm

    r635 r645  
    2828use Template;
    2929use NPEMap::Config;
     30use NPEMap::GeoConverter;
    3031use Date::Format;
    3132use Chart::Strip;
     
    129130
    130131    my $rss = new XML::RSS (version => '1.0');
     132    $rss->add_module(prefix=>'geo', uri=>'http://www.w3.org/2003/01/geo/wgs84_pos');
     133    $rss->add_module(prefix=>'os', uri=>'http://downlode.org/Code/RDF/Ordnance_Survey/schema/1');
    131134    $rss->channel(
    132135        title => 'NPEmap - all postcodes',
     
    142145        my $postcode_text = $postcode->{outward} . ' ' .
    143146                            $postcode->{inward} || '';
     147        my ($lat,$long) = eastingNorthingToLatLong(
     148              $postcode->{easting},$postcode->{northing},$postcode->{grid});
     149
    144150        $rss->add_item(
    145151            title => $postcode_text,
     
    148154            dc => {
    149155                date => $postcode->{iso_date}
    150             }
     156            },
     157            geo => {
     158                lat => sprintf("%0.6f", $lat),
     159                long => $long = sprintf("%0.6f", $long),
     160            },
     161            os => {
     162                x => sprintf("%d", $postcode->{easting}),
     163                y => $long = sprintf("%d", $postcode->{northing}),
     164            },
    151165        );
    152166    }
Note: See TracChangeset for help on using the changeset viewer.