none
Virtual Earth GEORSS feed using ashx handler RRS feed

  • Question

  • Hello All,

     

    I am working on a virtual earth map to pull points from a database.  To pull the points from my database I am attempting to use an ashx handler.  All went well until I tried to load utilize my ashx handler and place the pushpins on the map.  When I tried I got an error mesage Unable to load source file

     

    my code I am using to try to load the my GEORSS feed is

     

    var veLayerSpec = new VELayerSpecification();
       veLayerSpec.Type = VELayerType.GeoRSS;
       veLayerSpec.ID = 'BOL';
       veLayerSpec.LayerSource = 'http://localhost/rss.ashx';
       veLayerSpec.Method = 'get';
       alert(veLayerSpec.Type);
       map.AddLayer(veLayerSpec);

     

    where rss.ashx is my ashx handler that handles my call to a sql database and builds the xml string.

     

    What am I doing wrong here. 

     

    Thanks Mike

    • Moved by Ricky_Brundritt Saturday, March 10, 2012 11:30 AM (From:Bing Maps: Map Control and Web services Development)
    Thursday, August 23, 2007 3:17 PM

Answers

All replies

  • I am in the exact same boat as you are.
    For me, it works fine in FireFox, however IE fails to load feed from ashx
    I am using the latest version syntax.

    Did you manage to solve it? Plesae help anyone?

    Sanjeev.
    Monday, September 24, 2007 8:21 AM
  • Depending on the sensitivity of your data, can you load the raw output of the call to your ashx page and post it here?  The GeoRSS parser in v5 is very particular about the GeoRSS spec (compared to v4).  Also, are you getting any of the callback error messages or client script error alerts messages in IE (yellow exclamation in the status bar)?  I have no problems using the ashx approach with IE.

    Monday, September 24, 2007 1:16 PM
  • I am still working on solving this issue.  I know my ashx handler works, but I realized that I have 10,000 points pulled from my sql database that needs to be plotted.  I am going to have to use AJAX to do this.  I am currently looking into AJAX to try to figure this one out.

     

    Mike

    Tuesday, September 25, 2007 9:09 PM
  • Yes, common issue. 10,000 points = MB's of data. Just like VE streams tiles on demand I highly recommend you do the same with your data.

    http://www.viawindowslive.com/Articles/VirtualEarth/ClusteringVirtualEarthonVersion5.aspx 

     

    Sounds like a really simple series of articles without all the clustering logic is required? Things like streaming the pins on demand, popup data on demand etc. Let me know what would be most useful.

     

    John.

    Tuesday, September 25, 2007 10:54 PM
    Moderator
  • Hello again,

     

    I have yet to take care of the clustering issue, but I have had success utilizing my ashx handler to get all of my points loaded on my map in about 10 seconds. 

     

    In case anybody is interested the code is below. 

     

    I have of course used AJAX to make this posible.

    rss.ashx is my ashx handler that I am using.  I can paste that code if anybody is interested.  I will be happy to answer any questions about this code

     

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html>  
    <head>     
    <title></title>     
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">     
    <script src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=5"></script>     
    <script>     
    var map = null;


              function ajaxFunction(){ 
     var xmlHttp;
     
      try
           {    // Firefox, Opera 8.0+, Safari   
           xmlHttp=new XMLHttpRequest();   
       }// end try Firefox
     
      
      catch (e){
              // Internet Explorer   
      try{
             xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");     
      }// end try
       
      catch (e){
          
      try{       
       xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");       
      }// end try
         
      catch (e){
              alert("Your browser does not support AJAX!");       
       return false;     
      }// end catch browser does not support     
      }// end catch (e)
             }// end catch Internet Explorer
                 

       window.status = "loading pushpin data please wait";
       xmlHttp.open("GET","rss.ashx",true);
           xmlHttp.send(null); 

          xmlHttp.onreadystatechange=function(){
             if(xmlHttp.readyState==4){
        alert(xmlHttp.status);
               alert("true " + xmlHttp.readyState);
        var xmlDoc = xmlHttp.responseXML;
               IDNodes = xmlDoc.getElementsByTagName("Identity");
        LocNodes = xmlDoc.getElementsByTagName("Location");
        TitleNodes = xmlDoc.getElementsByTagName("Title");
        DetNodes = xmlDoc.getElementsByTagName("Details");
        LatNodes = xmlDoc.getElementsByTagName("Latitude");
        LogNodes = xmlDoc.getElementsByTagName("Longitude");
        alert(IDNodes[2].firstChild.nodeValue);
        window.status = "Done"; 
        map.AttachEvent('onendzoom', OnEndZoom);    
       }// end else
            }// xmlHttp.onreadystatechange function()
       


      }// end ajax function
     
    function returnNode(xmldoc){
    var testNode;

    }// end returnNode 

    function GetMap()     
    {        ajaxFunction()
     map = new VEMap('myMap');        
    map.LoadMap(new VELatLong(39.89288, -89.14306), 4);    
    }// end GetMap        


     
    function OnEndZoom()
    {

        var currentZoom = map.GetZoomLevel();
        alert("Zoom = " + currentZoom);
        alert("Center = " + map.GetCenter());
        if(currentZoom == 5){
      
          alert("RSS Feed will be activated at this point");
      
        }// end if
     
    }// end onEndZoom

    </script>  

    </head>  
    <body onload="GetMap();">     
    <div id='myMap' style="position:relative; width:100%; height:100%;"></div>  
    </body>
    </html>     

     

     

    Mike

    • Proposed as answer by Heshti Monday, October 17, 2011 3:07 PM
    • Unproposed as answer by Heshti Monday, October 17, 2011 3:07 PM
    Wednesday, September 26, 2007 3:04 PM
  • Hey Mike ,

    Can you tell me how does your rss.ashx file look like please.

    Here I am at a point where I have to display about 40 pushpins for each locations, for example a particular postcode would have on a 20 km radius about 40 postcodes, so which means 40 pushpins. and this needs to be dynamically queried. I am aware of GeoRSS but I am not sure how do I communicate with my database to do this. Can you hint me an Idea please?

     


    Heshti
    • Edited by Heshti Monday, October 17, 2011 3:08 PM
    Monday, October 17, 2011 3:07 PM