jmoseley502
asked on
How do I reload and refresh GeoRss Feed at specified interval - Bing map website
This page displays moving vehicles with GPS. The Script works fine but - The feed is very dynamic - updated every 10 seconds. I need a way to remove and reapply the GeoRss Layer at a set interval - hopefully without reloading the entire map. Attached it the current code - any help would be fantastic!!! Thank you....
I need this function to run, then at a set time clear and reload -
function EventMapLoad()
{
geoRssLayer1 = new VEShapeLayer();
var geoRssLayerSpec1 = new VEShapeSourceSpecification (VEDataTyp e.GeoRSS, "http://xxx.xxx.xxx.xxx/xxxx.xml", geoRssLayer1);
map.ImportShapeLayerData(g eoRssLayer Spec1, onFeed1Load, true);
}
I need this function to run, then at a set time clear and reload -
function EventMapLoad()
{
geoRssLayer1 = new VEShapeLayer();
var geoRssLayerSpec1 = new VEShapeSourceSpecification
map.ImportShapeLayerData(g
}
<title>sample</title>
<meta http-equiv="Content-Type" content="text/html; "expires" content="0"; charset=utf-8">
<script src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=5"></script>
<script>
var map = null;
var geoRssLayer1 = null;
function onFeed1Load(layer)
{
var numShapes = layer.GetShapeCount();
for(var i=0; i < numShapes; ++i)
{
var s = layer.GetShapeByIndex(i);
s.SetCustomIcon("Car.ico");
}
}
function EventMapLoad()
{
geoRssLayer1 = new VEShapeLayer();
var geoRssLayerSpec1 = new VEShapeSourceSpecification(VEDataType.GeoRSS, "http://xxx.xxx.xxx.xxx/xxxx.xml", geoRssLayer1);
map.ImportShapeLayerData(geoRssLayerSpec1, onFeed1Load, true);
}
function CreateMap()
{
map = new VEMap('myMap');
map.onLoadMap = EventMapLoad;
map.LoadMap(new VELatLong(30.01416, -97.8964), 5, VEMapStyle.Road);
}
function CheckBox1Clicked(cb)
{
if (cb.checked)
{
geoRssLayer1.Show();
}
else
{
geoRssLayer1.Hide();
}
}
</script>
</head>
<body onload="CreateMap();">
<div id='myMap' style="position:relative; width:800px; height:600px;"></div>
<div style="border:solid black 1px; margin-left:5px; background:#fff; position:absolute; top:475px;">
<div style="font-weight:bold;">Show/Hide Cars GeoRss </div>
<div><input id='CB1' type=checkbox checked onclick="CheckBox1Clicked(this)" />:<img align=middle src='Cars.ico'/>Cars</div>
</div>
</body>
</html>
ASKER
I am still working with this suggestion. At first pass it is not causing a refresh. I deployed it late last night and tested without success. I will try and troubleshoot it this am. Thank you - john
ASKER
This doesnt seem to be working. Does anyone have any other suggestions. The last solution - which should work does not cause a refresh of the units.... not sure where to go from here. If I close the browser window and open it again I get the latest positions. - but this fix or just clicking refresh doesnt get the latest positions....
Do you have a lve demo page for this? I don't know what type of data http://xxx.xxx.xxx.xxx/xxxx.xml is supposed to deliver so I can't replicate the problem.
ASKER
yes!,, can you email me off line so that the addresses are not forever posted on this site... jmoseley@smhcems.com
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This did resolve the problem after changing the RSS Feed. Thank you!
Open in new window