| Ricky's profileRicky's Bing Maps BlogBlogSkyDrive | Help |
|
|
11/2/2008 VE Imagery Service, Polygons and PolylinesCurrently the VE Imagery service does not have the ability to render polygons or polylines on a map image. The high level steps involved to accomplish this are as follows: 1) Calculate the best map view for an array of Location objects. 2) Request map image from the imagery service that matches the best map view calculated in step 1. 3) Calculate the pixel coordinate of each location. 4) Use .NET drawing tools to draw polygons and polylines. Many of the steps in this article are explained in the article title VE Imagery Service and Custom Icons The following code block shows how to draw a polygon on a map image from an array of points that form a polygon. private void AddPolygon(BestView view, Image map, Location[] polygon) The following code block shows how to draw a polyline on a map image from an array of points that form a polyline. private void AddPolyline(BestView view, Image map, Location[] polyline) By combining these algorithms with the code in the article; VE Imagery Service and Custom Icons you can add your polygons and polylines to a VE map image. This can be useful to create tile layers when wanting to display a large number of polygons in the JavaScript version of Virtual Earth without having performance issues. Complete source code can be downloaded here: http://cid-e7dba9a4bfd458c5.skydrive.live.com/self.aspx/VE%20Sample%20code/VEPolygonsImageryService.zip |
|
|