Load GeoRSS Feed From Geoserver

250 views
Skip to first unread message

Brian Behling

unread,
Feb 12, 2013, 2:23:45 PM2/12/13
to timemap-d...@googlegroups.com
Is it possible to load a GeoRSS feed from Geoserver into Timemap instead of an rss file and is Geoserver supported? For example:


When I try to load the feed, there isnt an XML response from the server. Then when I load the RSS file generated by Geoserver, an error in timemap.js says there is an invalid date somewhere in the RSS file.

Nick Rabinowitz

unread,
Feb 18, 2013, 11:27:55 AM2/18/13
to brian....@gmail.com, Timemap.js Development
There's no reason this shouldn't be possible, but you are probably running into the Same Origin Policy - unless your geoserver is the same host (including port) as the host serving your timemap, you may not be able to load it. Common approaches include a local proxy, CORS (but this won't work on every browser), and using YQL as a poor man's JSONP proxy.

I can't speak to the invalid date w/o seeing the file.


--
You received this message because you are subscribed to the Google Groups "Timemap.js Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to timemap-develop...@googlegroups.com.
To post to this group, send email to timemap-d...@googlegroups.com.
Visit this group at http://groups.google.com/group/timemap-development?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Brian Behling

unread,
Feb 18, 2013, 2:08:37 PM2/18/13
to timemap-d...@googlegroups.com
To fix the invalid date issue, I had to use the AtomPub feed from Geoserver, and save that to a local file to load into Timemap.

I suppose this could be a cross domain policy issue. Geoserver is on port 8081 and Timemap is the default port, 80. Both are localhost.

Mark Lawlor

unread,
Feb 18, 2013, 5:55:13 PM2/18/13
to timemap-d...@googlegroups.com
Hey Brian, we can host the Timemap and GeoServer on the same server. I've got Timemap hosted on one of the Windows web servers .. on Tuesday I'll port it over to one on the linux web servers that have GeoServer hosted on it. It look like one of the guys in the next lab over has a working example. I'll try to get you a code snippet of how he implemented it.

On Tuesday, February 12, 2013 12:23:45 PM UTC-7, Brian Behling wrote:

Mark Lawlor

unread,
Feb 18, 2013, 6:43:54 PM2/18/13
to timemap-d...@googlegroups.com
Hey Brian,

I have Timemap hosted on one of the Windows web servers ... I'll move it over to the linux VMs web server that is hosting Geoserver and the data. I saw an example Friday from another lab rat (different group) in the back office pulling data from a local server .. he just started playing with Timemap. I'll see if I can get you a code snippet Tuesday.

Mark


On Tuesday, February 12, 2013 12:23:45 PM UTC-7, Brian Behling wrote:

Nick Rabinowitz

unread,
Feb 18, 2013, 6:45:36 PM2/18/13
to brian....@gmail.com, timemap-d...@googlegroups.com
Yup, that would do it. You can't cross ports with AJAX unless you do some extra work in one way or another.

-Nick
--

Alan Leslie

unread,
Feb 20, 2013, 9:29:48 PM2/20/13
to timemap-d...@googlegroups.com
Hi Brian

First of all thanks because I have wanted to play around with a GeoRSS timemap for a while but your post has given me the motivation to look into it further.

I started by adapting Nick's GeoRSS earthquake example - https://timemap.googlecode.com/svn/tags/2.0.1/examples/earthquake_georss.html.
To keep it simple I converted it to use another earthquake GeoRSS - http://www.bgs.ac.uk/feeds/MhSeismology.xml.

To get it all working I have had to fix problems with cross site scripting and date format errors. The result is at http://www.alfi2fe.co.uk/brit_earthquake_georss.html.

The problems that I came across may not be the same as you encountered, but mine were (code fixes are in - yql_georss_loader.js):
1) Date format errors - as you did I got date format errors. After inspecting the XML file I found that my problems were because the pubDate year was in 2-digit format. I have added a function to preprocess the XML to convert the pubDate year to 4-digit format.
2) Calling to the bgs.ac.uk site gave cross site scripting problems - to get round this I have used YQL. The YQL results XML has a query and results structure. So an extra couple of levels from the XML file. To get it to work with the georss.parse function rather than pass in the root node I pass in its grand  child. 

Sorry if this isn't too clear, if you look at the code I think it will make more sense.

Other than that I noticed that when I was using Firebug and encountered the cross site scripting problem that the GET request was marked in red rather than in black as is normally the case. If I see this in future I will look into whether this really is an indication that there is a cross site scripting problem.

Also I would like to look into using a local geoserver to publish GeoRSS data. if you can point me to a good tutorial web page I would appreciate it.

Cheers

Alan

Brian Behling

unread,
Feb 21, 2013, 9:05:40 PM2/21/13
to timemap-d...@googlegroups.com
Alan, 

I also found that using JSONP, we can bypass the Cross Domain issues. Theoretically, one could place a call to Geoserver in their servlet or PHP script, process the Geoserver result on the server, then return the data wrapped in a JSONP function.

For a  Geoserver GeoRSS tutorial, the only one I can find from a Google search is:

and its really not that helpful.

On Tuesday, February 12, 2013 12:23:45 PM UTC-7, Brian Behling wrote:

Alan Leslie

unread,
Feb 27, 2013, 12:28:19 PM2/27/13
to timemap-d...@googlegroups.com
Thanks for the link Brian.

I know that you have gone for the JSONP/Server implementation but I have found out a little more info about the RSS GML implementation that I want to add for completeness.

I have taken the GeoServer states layer RSS mentioned in the article and plugged it into Nick's GeoRSS example. The invalid date error that I get when I do this is because there is no date time (pubDate) data at all. Now when you use the google spreadsheet loader and there is no date time data it loads the map data but does not add anything to the timeline. In order to get the same behaviour for GeoRSS you could override Timemap.loaders.georss.parse so that the code that deals with pubDate leaves data.start unset when there is no pubDate available. For example:

            if (feedType == 'rss') {
                // RSS needs date conversion
                var pubDateString = getTagValue(pm, "pubDate");

                if (pubDateString.length > 0) {
                    var d = new Date(Date.parse(pubDateString));
                    // reformat
                    data.start = formatDate(d);
                }
            }

Not pretty I know but it allows the map data to load.

I also had a look at the atom feed and it looks to me like the updated date is usually set to the date of the request. Hence if you scroll the timeline so that that date is not visible the map data will disappear.

I have upgraded my previous YQL example to take any feed reference (apart from localhost) - http://www.alfi2fe.co.uk/GeoRSSTimemap.html.

Hope that helps.

Alan
Reply all
Reply to author
Forward
0 new messages