none
Find pushpin along the route RRS feed

  • Question

  • Hi,

    We have wanted to plot the pushpin along the route. We have find the code in below link
    https://msdn.microsoft.com/en-us/library/mt761782.aspx. But it do not works in our case. 

    We wanted to show our pushpin along the route. For example we have 100 puhspin and when we plot route then we want to show only those pushpin those say suppose 5 miles along the route. Is it possible to achieve this.

    Please let us know your feedback.

    Waiting for your reply.

    Thanks!


    Balasaheb

    Wednesday, January 10, 2018 1:56 PM

Answers

  • The general process to do this is to get the points that make up the route line, create a polyline, buffer it the distance from the route line you want to search, this then forms a polygon that represents your search area, then use this to search against your pushpins but doing an intersection test. However if you just want to filter the data that is already rendered on the map, that can be done two. Here is a code sample: http://bingmapsv8samples.azurewebsites.net/#Select%20Pushpins%20Along%20a%20Route

    If you store your data in the Bing Spatial Data Services, here is an example of doing a search along a route: http://bingmapsv8samples.azurewebsites.net/#Search%20Along%20a%20Route


    [Blog] [twitter] [LinkedIn]


    Friday, January 12, 2018 7:08 AM
  • 1. If you are seeing this difference in the sample, note that every time that code runs it generates a bunch of random locations on the map. So the data displayed/filtered the first time is different the second time. 

    2. This is to be expected. This is a heavy calculation. If you want to be able to reform this on larger datasets you need to do this server side in a spatial database or via the Bing Spatial Data Services (but this one doesn't let you change the distance).


    [Blog] [twitter] [LinkedIn]

    Tuesday, March 13, 2018 6:17 PM

All replies

  • The general process to do this is to get the points that make up the route line, create a polyline, buffer it the distance from the route line you want to search, this then forms a polygon that represents your search area, then use this to search against your pushpins but doing an intersection test. However if you just want to filter the data that is already rendered on the map, that can be done two. Here is a code sample: http://bingmapsv8samples.azurewebsites.net/#Select%20Pushpins%20Along%20a%20Route

    If you store your data in the Bing Spatial Data Services, here is an example of doing a search along a route: http://bingmapsv8samples.azurewebsites.net/#Search%20Along%20a%20Route


    [Blog] [twitter] [LinkedIn]


    Friday, January 12, 2018 7:08 AM
  • Hi Ricky,

    Thanks for your response. It is really help us.

    We will check.

    Thanks!

     


    Balasaheb

    Monday, January 15, 2018 6:33 AM
  • Hi Ricky,

    We have used the above code to find the pushpin along the route but we found following issues.

    1. When we pass the distance unit as kilometers then it gives us the 15 pushpin and when we distance unit as mile then it shows 10 puhspins along the route. So it may be wrong because in case of mile it shows more pushpin than kilometer.

    We used following line of code

    var searchArea = Microsoft.Maps.SpatialMath.Geometry.buffer(routePath, parseFloat(alongRouteDist), "mile");

    2. When we used below line then in sometime it take too much of time when pushpin count is more say suppose 10K. 

     var intersectingPins = Microsoft.Maps.SpatialMath.Geometry.intersection(pins, searchArea);

    Is there any solution for above two issue.

    Thanks!


    Balasaheb

    Tuesday, March 13, 2018 2:38 PM
  • 1. If you are seeing this difference in the sample, note that every time that code runs it generates a bunch of random locations on the map. So the data displayed/filtered the first time is different the second time. 

    2. This is to be expected. This is a heavy calculation. If you want to be able to reform this on larger datasets you need to do this server side in a spatial database or via the Bing Spatial Data Services (but this one doesn't let you change the distance).


    [Blog] [twitter] [LinkedIn]

    Tuesday, March 13, 2018 6:17 PM
  • Hi Ricky,

    Thanks for your reply.

    For point 1 we are doing search at our data. 

    For point 2 we are doing at client side and we do not do it at server side. Is there way to increase performance at client side. 

    Thanks!


    Balasaheb

    Monday, March 19, 2018 2:35 PM
  • There really isn't much you can do on the client side to improve performance. These are very complex and intensive calculations. 

    [Blog] [twitter] [LinkedIn]

    Tuesday, March 20, 2018 4:33 PM