3

I am new to geoRss.

How can we write the geoRss feed. I have my lat long values and some other fields in mysql db which i want to add in the geoRss feed.

Thanks and Regards, Ashish

2 Answers 2

5

Try this code to output geoRSS

header("Content-type: text/xml");
    $xml_output = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
    $xml_output .= "<rss version=\"2.0\" 
      xmlns:geo=\"http://www.w3.org/2003/01/geo/wgs84_pos#\" 
      xmlns:dc=\"http://purl.org/dc/elements/1.1/\">";

    $xml_output .= "<channel>";
    $xml_output .= "<title>My GeoRSS</title>
     <description>Description here</description>
     <link>http://url-here.com/</link>
     <dc:publisher>your_name</dc:publisher>
     <pubDate>Wed, 13 Apr 2011 23:56:15 PST</pubDate>
     <item>
       <pubDate>Wed, 13 Apr 2011 23:56:15 PST</pubDate>
       <title>Feed title</title>
       <description>Feed description</description>
       <link>Feed URL</link>
       <geo:lat>Latitude</geo:lat>
       <geo:long>Longitude</geo:long>
     </item>
   </channel>
</rss>
";

print $xml_output;

Replace the respective fields as taken from your database..

-2

[enter link description here][1]

[1]: https://"My GeoRSS Description here http://url-here.com/ <dc:publisher>your_name</dc:publisher> Wed, 13 Apr 2011 23:56:15 PST Wed, 13 Apr 2011 23:56:15 PST Feed title Feed description Feed URL geo:latLatitude</geo:lat> geo:longLongitude</geo:long> "

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.