Download Earth is not affiliated with Google in any way

Download Google Earth is free

By using our site you get free access to: Our Google Earth Tips & Tricks guides, Free Installation Guide & Videos, Free Technical Support Only Available To Our Members, More Free Software You Can Download, News On Free Software & Other Important Information, Access To Our Members Only News & Help Forums

Just Click Here To Get Started

Setting and Getting VEShape Object Properties

Once a shape has been added to a map you can use can use the class VEShape and its methods to get the properties of the shape. These properties control the attributes of the shape like color and width, custom icon, image file etc. the title and description properties can also contain custom html that may help you to further extend and modify your shapes.

Firstly you need to create an array of VELatLong objects. The capacity of the array depends upon the shape. I-e a polygon requires 3 points, a line requires 2 points and a pinpoint requires only one point. The code that can be used is, var points = new Array( new VELatLong(45.01188,-111.06687, 0, VEAltitudeMode. RelativeToGround), new VELatLong(45.01534,-104.06324, 0, VEAltitudeMode. RelativeToGround), new VELatLong(41.01929,-104.06, 0, VEAltitudeMode. RelativeToGround), new VELatLong(41.003,-111.05878, 0, VEAltitudeMode. RelativeToGround)).

Create a VEShape object. Here is the code, var myPolygon = new VEShape(VEShapeType.Polygon, points); the code creates a new polygon shape, "myPolygon", at the specified coordinates. Add the VEShape object named "myPolygon" to the map.

Edit the properties of the shape. myPolygon.SetTitle("My Polygon"); here the title is set; myPolygon.SetDescription("This is the description for my polygon."); the description in this code strings are added for the title and description of the shape.

For Adding a shape layer to a map use the following steps: First of all you need to initialize a new instance of the VEShapeLayer classVEShapeLayer Class. var myShapeLayer = new VEShapeLayer();. Now add the shape layer to the map, using the VEMap.AddShapeLayer Method. map.AddShapeLayer(myShapeLayer); Now you need Define an array of VELatLong objects.

var points = new Array( new VELatLong(45.01188,-111.06687, 0, VEAltitudeMode. RelativeToGround), new VELatLong(45.01534,-104.06324, 0, VEAltitudeMode. RelativeToGround), new VELatLong(41.01929,-104.06, 0, VEAltitudeMode. RelativeToGround), new VELatLong(41.003,-111.05878, 0, VEAltitudeMode. RelativeToGround) );

Once the array is created, create a VShape object to add to the map with this one, var myShape = new VEShape(VEShapeType.Polygon, points);

Now finally add the shape to the shape layer using the VEShapeLayer.AddShape method. myShapeLayer.AddShape(myShape);

Using Routing and Directions: Virtual Earth’s routing and driving directions feature can be used to show routes on your custom maps. You can write your own event handler to customize the driving directions.

Getting a route: To display a driving route from one place to another with a few point in between you have to call the VEMap.GetDirections Method. A point can be specified as an address, place name or a VELatLang class object. Both the following examples are valid. var myOptions = new VERouteOptions(); myOptions.SetBestMapView = false; // Don't change map view. myOptions.RouteCallback = myRouteHandler; this gets a VERoute. map.GetDirections(["space needle", "LA Coliseum", "area 51"], myOptions); map.GetDirections(["1 Microsoft Way, 98052", new VELatLong(47.969,-122.39, 0, VEAltitudeMode.RelativeToGround)], myOptions); now the route is drawn on the map complete with start point, end point and all the interim points icon.

Showing Driving Directions: The details about the route are stored in the VERoute object, including the details about the driving directions. When calling the GetDirections method, you can specify a callback function to handle the VERoute object and use the information to display driving directions.

Technorati Tags: , , , ,

Tags: Microsoft Virtual Earth

Share and Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • blinkbits
  • BlinkList
  • blogmarks
  • co.mments
  • connotea
  • del.icio.us
  • De.lirio.us
  • digg
  • Fark
  • feedmelinks
  • Furl
  • LinkaGoGo
  • Ma.gnolia
  • NewsVine
  • Netvouz
  • RawSugar
  • Reddit
  • scuttle
  • Shadows
  • Simpy
  • Smarking
  • Spurl
  • TailRank
  • Wists
  • YahooMyWeb

Comments are closed.

We are not the company "Google" which is a registered trademark. We are a non affiliated 3rd party who is providing no cost tips, advice and troubleshooting for various software included in the "Google Software Pack".

I highly recommend the Google Software Pack. It comes with a lot of great software that is all FREE. You can also pick and choose which of the software products you want to download. You don't have to download them all. If you have a Mac or you don't want the Google Software Pack for some reason you can download it directly from the main site.

The main site for Google Earth is managed by Google at:

http://earth.google.com/