AngryHacker
AngryHacker

Reputation: 61606

How to draw a polygon on BingMap based on pushpins?

I have a number of Pushpins on a BingMap v8. I'd like to draw a polygon around these pins.

I see a lot of examples of how to draw polygons manually, but see nothing about using Pushpins as a guide.

I am looking for something like below. Does this functionality exist in BingMaps v8?

enter image description here

Upvotes: 1

Views: 532

Answers (1)

rbrundritt
rbrundritt

Reputation: 17954

There are two ways to do this. The most common is to use a Convex Hull which generates a polygon that is similar to stretching an elastic around the pushpins. The second option is a Concave Hull which tries to create a tighter fitting polygon around the data set. The Bing Maps V8 web control has built in calculations for both of these in the spatial math module. Here is a code sample that shows how to do both of these: http://bingmapsv8samples.azurewebsites.net/#Concave%20and%20Convex%20Hulls

Here is documentation on the Spatial Math module: https://msdn.microsoft.com/en-us/library/mt712834.aspx

Upvotes: 1

Related Questions