none
Pushpin proximity to routeline RRS feed

  • Question

  • Hello, I'm making a metro app coding in c# and xaml. I have a data set of about 700 items representing locations on the map that I use to databind as pushpins to my map and that is fine. However, I need for some functionality in the app I need to narrow down this data set. Depending on the location of the pushpin with relation to a routeline drawn with directions from bing maps rest services.

    I get the route to draw correctly and the pushpins to display but I would only like pushpins near the route to be visible. I have tried matching gps coordinates between the data items and gps coordinates of my route but they are never exact (they are nearby but never exact on the map). I tried trimming the gps coordinates but the issue crops up where I'm matching several legs of the route with 700 location items and that is a lot more processing than I think is feasible. Any advice would be greatly appreciated. I will include more information as needed. Cheers.

    Thursday, January 10, 2013 5:07 PM

Answers

  • If you're binding your data collection you should be doing your calculations off it, not the resulting pushpins.

    Friday, January 11, 2013 5:59 PM

All replies

  • Do the visibility processing off the UI thread. The visibility will be somewhat delayed when a new route appears but the app will remain responsive. You'll want to walk each segment of the route and do a point to line distance calculation for each pushpin location.
    Thursday, January 10, 2013 6:31 PM
  • Thanks for the response. My current format for placing the pushpins is with a data collection which I bind in xaml with a map items control template. But I'm not sure how to access each individual pushpin to do the distance calculation from the route legs, can you explain further? 

    Thanks.

    Friday, January 11, 2013 10:58 AM
  • If you're binding your data collection you should be doing your calculations off it, not the resulting pushpins.

    Friday, January 11, 2013 5:59 PM