Reputation: 139
I have multiple locations which are pin pointed on my Bing Map WPF by longitude and latitude coordinates, I know how to measure distance between two set locations and display all pins at once. But in order to be more efficient and reduce needed lag on the map I want to show only points within a certain distance of a fixed point.
For example Big ben at 51.500733, -0.124658 was my fixed point and if another one of my locations was in lets say in a 5 mile radius e.g. London eye 51.503364, -0.119522 it would show but anything out side of radius would not. Currently the process is activated when the user click a single button to one of my points which it then displays a pushpin. Currently I concentrating on the theory of using a If statement within VB to filter out a range of Longitude and Latitude coordinates for set locations.
Any of ideas on improving my method or different takes would very beneficial.
Upvotes: 0
Views: 298
Reputation: 18052
This is a very common task that can be done in a lot of different ways. It all depends on where your data is stored. If you store your data in the Bing Spatial Data Services, it exposes it as a spatial REST service that provides nearby search functionality for you. You can find a good article around this here: https://msdn.microsoft.com/en-us/library/dn948092.aspx
If it is hosted in a database, then take a look at this blog post on how to create a spatial REST service to expose your data. Being that this is a WPF app you can skip the service part and add most of the code directly into your WPF app.
https://blogs.bing.com/maps/2013/08/05/advance-spatial-queries-using-entity-framework-5/
If your data is sitting in a list, you can simply loop through it and grab all locations that are within a certain distance of your center point.
Upvotes: 2