Note that there are some explanatory texts on larger screens.

plurals
  1. POBing maps Pushpins from XML Feed
    text
    copied!<p>Ive been using this tutorial to try and display pushpins on a map: <a href="http://compiledexperience.com/windows-phone-7/tutorials/quake" rel="nofollow">http://compiledexperience.com/windows-phone-7/tutorials/quake</a></p> <p>Im almost there wit hthe help you you guys below, but </p> <p>If I replace my bits with the original bits (commented out parts) and then do 'Start debugging', I get an unhandled exception. If I continue debugging I see the map and the pushpins for a split second and then it quits out. I put back the original commented code and its fine... Let me know if you need anymore info. Im so frustrated at this :( Thanks once again.</p> <p>Callstack:</p> <blockquote> <p>QuakeML.dll!QuakeML.App.OnUnhandledException(object sender = {QuakeML.App}, System.Windows.ApplicationUnhandledExceptionEventArgs e = {System.Windows.ApplicationUnhandledExceptionEventArgs}) Line 37 + 0x5 bytes C# System.Windows.dll!MS.Internal.Error.CallApplicationUEHandler(System.Exception e = {"UIElement.Arrange(finalRect) cannot be called with Infinite or NaN values in finalRect. "}) + 0x30 bytes<br> System.Windows.dll!MS.Internal.Error.CallAUEHandler(uint hr = 2148474880, out uint bIsHandled = 0) + 0x6 bytes<br> [Native to Managed Transition] </p> </blockquote> <p>Current code:</p> <pre><code>namespace QuakeML { public partial class MainPage { public MainPage() { InitializeComponent(); Loaded += OnLoaded; } private void OnLoaded(object sender, RoutedEventArgs e) { LoadQuakes(); } private void LoadQuakes() { var webClient = new WebClient(); webClient.OpenReadCompleted += OnOpenReadCompleted; var uri = "http://www.tfl.gov.uk/tfl/businessandpartners/syndication/feed.aspx?email=mycomputer@clara.co.uk&amp;feedId=3"; // var uri = "http://magma.geonet.org.nz/services/quake/quakeml/1.0.1/query?startDate=2010-09-03&amp;endDate=2010-09-05&amp;magnitudeLower={0:0.0}&amp;magnitudeUpper=8"; webClient.OpenReadAsync(new Uri(uri, UriKind.Absolute)); } private void OnOpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { var document = XDocument.Load(e.Result); if(document.Root == null) return; var xmlns = XNamespace.Get("http://www.tfl.gov.uk/tfl/syndication/namespaces/geo"); //var xmlns = XNamespace.Get("http://quakeml.org/xmlns/quakeml/1.0"); var events = from ev in document.Descendants("item") select new { Latitude = Convert.ToDouble(ev.Element(xmlns + "Point").Element(xmlns + "lat").Value), Longitude = Convert.ToDouble(ev.Element(xmlns + "Point").Element(xmlns + "long").Value), }; //var events = from ev in document.Descendants(xmlns + "event") // select new // { // Latitude = Convert.ToDouble(ev.Element(xmlns + "origin").Element(xmlns + "latitude").Element(xmlns + "value").Value), // Longitude = Convert.ToDouble(ev.Element(xmlns + "origin").Element(xmlns + "longitude").Element(xmlns + "value").Value), // }; QuakeLayer.Children.Clear(); foreach(var ev in events) { var accentBrush = (Brush)Application.Current.Resources["PhoneAccentBrush"]; var pin = new Pushpin { Location = new GeoCoordinate { Latitude = ev.Latitude, Longitude = ev.Longitude }, Background = accentBrush, }; QuakeLayer.AddChild(pin, pin.Location); } } private void OnRefresh(object sender, RoutedEventArgs e) { LoadQuakes(); } } } </code></pre> <p>Map item on mainpage:</p> <p> </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload