[OpenLayers-Users] Any idea of using setUrl on GeoRSS layer?

Eric Lemoine eric.c2c at gmail.com
Wed Oct 8 15:38:01 EDT 2008


Hi. You use a GeoRSS layer and look at the code of the Layer.Image class!

Layer.GeoRSS does not have a setURL method. You can try something like
this in your setInterval callback:

layer.clearFeatures();
layer.loaded = false;
layer.loadRSS();

Hope this helps,

Eric

2008/10/8, Deli Soetiawan <crushfire2004 at gmail.com>:
>
> Hi there,
>
> i tried to create a georss layer that can do auto-refresh after specified
> time, here the code for layer:
>
> var iconMarker = new OpenLayers.Icon("images/markerblue.png", new
> OpenLayers.Size(16,16));
> var rssLayer = new
> OpenLayers.Layer.GeoRSS('GeoRSS','georss.php',{icon:iconMarker});
> map.addLayer(rssLayer);
>
> here the code for refreshing georss layer:
>
> setInterval(reloadRSS,60000); //reload every 60 seconds
> function reloadRSS() {
> 	rssLayer.setUrl('georss.php');
> }
>
> the georss.php generate dynamic georss from database (not really important
> what the content is)
> according to:
> http://trac.openlayers.org/browser/trunk/openlayers/lib/OpenLayers/Layer/Image.js
>
> setUrl function was defined, the parameter for this function is url of the
> georss, so it can be use to reload the xml (formerly in Kamap application
> i've made i use this kind of function) but it can't work?
>
> when i debug using JS debugger (in Opera 9.6 Final):
> Timeout thread: delay 60000 ms
> Error:
> name: TypeError
> message: Statement on line 41: Type mismatch (usually non-object value
> supplied where object required)
>
> the line 41 is referencing to "rssLayer.setUrl('georss.php');" code, so why
> type mismatch? do i set invalid type for parameter? is it correct to use
> string ("georss.php") as parameter?
>
> or any other way to refresh this layer type? (if you can please share some
> working example :D)
>
> Thanks,
> Deli Soetiawan
> --
> View this message in context:
> http://www.nabble.com/Any-idea-of-using-setUrl-on-GeoRSS-layer--tp19873179p19873179.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>



More information about the Users mailing list