[GIS] GeoRSS in Leaflet

georssleafletxml

is it possible to integrate GeoRSS in Leaflet and how?
Couldn't find any hint.

For example this georss:

http://www.geonames.org/recent-changes.xml

Which looks like..

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<rss xmlns:georss="http://www.georss.org/georss" version="2.0">
<channel>
<title>GeoNames.org recent changes</title>
<link>http://www.geonames.org/recent-changes.html</link>
<description>50 most recent modifications</description>
<item>
<title>Museo Archeologico Statale</title>
<link>http://www.geonames.org/10628777/museo-archeologico-statale.html</link>
<guid>http://www.geonames.org/10628777/museo-archeologico-statale.html#revision=-1</guid>
<description>created</description>
<pubDate>Wed, 19 Aug 2015 16:52:43 +0200</pubDate>
<georss:point>39.08025 17.13105</georss:point>
</item>
<item>
<title>Palazzo Morelli</title>
<link>http://www.geonames.org/10628776/palazzo-morelli.html</link>
<guid>http://www.geonames.org/10628776/palazzo-morelli.html#revision=-1</guid>
<description>created</description>
<pubDate>Wed, 19 Aug 2015 16:52:19 +0200</pubDate>
<georss:point>39.08081 17.13135</georss:point>
</item>

<!-- More Entries Through Here -->

</channel>
</rss>

Best Answer

Building from the comment by @elrobis here is an example using jQuery for getting the georss and adding simple markers to a map:

<html>
<head>
    <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />
</head>
<body>
    <div id="map" style="width: 700px; height: 500px"></div>

    <script src="http://code.jquery.com/jquery-1.11.2.min.js"></script>
    <script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>

    <script>
        var lat = 39;
        var lng = 17;
        var zoom = 2;
        var map = L.map('map').setView([lat,lng],zoom);

        // set up the ajax call
        function getXML(url) {
            return $.get(url)
        }

        // fire and handle the result
        getXML('http://www.geonames.org/recent-changes.xml').done(function(xml){
            var output = {}; // restructure the xml as an object
            $(xml).find('item').each(function() {
                var nodes = $(this).children();
                $.each(nodes, function(i,node){
                    var name = node.tagName;
                    var value = node.textContent;
                    output[name] = value;
                });
                // build markers from the output and add to the map
                var marker = L.marker([output['georss:point'].split(' ')[0], output['georss:point'].split(' ')[1]]);
                var popupContent = output.description; 
                marker.bindPopup(popupContent)
                marker.addTo(map);
            });
        })

    </script>
</body>
</html>
Related Question