More on GeoRSS...

1137
10
02-03-2011 05:56 AM
adamestrada
New Contributor
If you check out this example with the 7 day earthquake feed it works just fine.

http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#GeoRSS

Plug any other GeoRSS feed in there (http://www.openstreetmap.org/traces/rss) and it doesn't work. Debugging it says there is a security issue but I've added my clientaccesspolicy.xml file to my project like suggested on several message boards. The contents are as follows.

<?xml version="1.0" encoding="utf-8"?>
<access-policy>
  <cross-domain-access>
    <policy>
      <allow-from http-request-headers="*" >
        <domain uri="*"/>
      </allow-from>
      <grant-to>
        <resource path="/" include-subpaths="true"/>
      </grant-to>
    </policy>
  </cross-domain-access>
</access-policy>


Why won't any other GeoRSS feeds work. I've basically copied the aforementioned example line by line. Suggestions are welcome!!!  I've attached my code page but basically the method that does all the parsing is this one.

 #region Parse GeoRSS with Linq
        private void RSS(Stream s)
        {
            try
            {
                GraphicsLayer graphicsLayer = Map.Layers["GeoRSSFeed"] as GraphicsLayer;
                graphicsLayer.ClearGraphics();

                XDocument doc = XDocument.Load(s);
                XNamespace geo = "http://www.w3.org/2003/01/geo/wgs84_pos#";
                XNamespace dc = "http://purl.org/dc/elements/1.1/";

                var rssGraphics = from rssgraphic in doc.Descendants("item")
                                  select new RssGraphic
                                  {
                                      Geometry = new MapPoint(
                                          Convert.ToDouble(rssgraphic.Element(geo + "long").Value, System.Globalization.CultureInfo.InvariantCulture),
                                          Convert.ToDouble(rssgraphic.Element(geo + "lat").Value, System.Globalization.CultureInfo.InvariantCulture)),
                                      Symbol = LayoutRoot.Resources["QuakePictureSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol,
                                      RssAttributes = new Dictionary<string, object>() { { "Title", rssgraphic.Element("title").Value },
                                                                                     { "Link", rssgraphic.Element("link").Value } }
                                  };

                foreach (RssGraphic rssGraphic in rssGraphics)
                {
                    rssGraphic.Geometry = _mercator.FromGeographic(rssGraphic.Geometry);
                    foreach (KeyValuePair<string, object> rssAttribute in rssGraphic.RssAttributes)
                    {
                        rssGraphic.Attributes.Add(rssAttribute.Key, rssAttribute.Value);
                    }
                    graphicsLayer.Graphics.Add((Graphic)rssGraphic);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }
        #endregion


Thanks,
Adam Estrada
0 Kudos
10 Replies
HunterPerkins1
New Contributor
Looks like it was a namepsace error on my part from copying code! Thanks for all your help Adam.
0 Kudos