[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

How do I reload and refresh GeoRss Feed at specified interval - Bing map website

Posted on 2009-07-12
7
Medium Priority
?
1,215 Views
Last Modified: 2012-05-07
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(VEDataType.GeoRSS, "http://xxx.xxx.xxx.xxx/xxxx.xml", geoRssLayer1);
    map.ImportShapeLayerData(geoRssLayerSpec1, onFeed1Load, true);
 
   
}

<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>

Open in new window

0
Comment
Question by:jmoseley502
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 82

Expert Comment

by:hielo
ID: 24842325
try:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 
<html>
<head>
<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");
    }
}
 
 
var timer=null;
var counter=10;
function EventMapLoad()
{
	if(--counter)
		timer=setTimeout(EventMapLoad,3000);
	else
		clearTimeout(timer);
    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>

Open in new window

0
 

Author Comment

by:jmoseley502
ID: 24868545
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
0
 

Author Comment

by:jmoseley502
ID: 24953308
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....
0
Plesk WordPress Toolkit

Plesk's WordPress Toolkit allows server administrators, resellers and customers to manage their WordPress instances, enabling a variety of development workflows for WordPress admins of all skill levels, from beginners to pros.

See why 2/3 of Plesk servers use it.

 
LVL 82

Expert Comment

by:hielo
ID: 24983943
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.
0
 

Author Comment

by:jmoseley502
ID: 24992024
yes!,,   can you email me off line so that the addresses are not forever posted on this site...  jmoseley@smhcems.com
0
 
LVL 82

Accepted Solution

by:
hielo earned 2000 total points
ID: 25027236
If you don't want to provide the url, you can post a sample set of your xml.

BTW: if you DO provide the url, once the problem is solved, you can request community support to change it back to http://xxx.xxx.xxx.xxx

They will gladly change it for you.

As for emailing, you are not allowed to post your email address in the discussions (like you did above) AND all discussions pertaining to your problem need to take place on this forum not offline.
0
 

Author Comment

by:jmoseley502
ID: 25372640
This did resolve the problem after changing the RSS Feed. Thank you!
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
This video teaches users how to migrate an existing Wordpress website to a new domain.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question