Getting Started with Virtual Earth
Getting started with the development of location based applications has never been easier than with Virtual Earth. You do not need to sign-up for a developer account; you can just visit the Software Development Kit (SDK) and start on your application immediately.
The “Interactive SDK” enables you to explore implementations of frequently used features. You can have a closer look at a real application in Virtual Earth and then flip through the tabulators to display the complete source code for this particular website or to review the reference for this feature. With just one mouse-click you can copy the complete source-code and with a second paste it into an empty HTML-document. Of course, there is also a traditional reference SDK available. There is an online version on the MSDN as well as a downloadable version in CHM-format. These resources as well as a forum and links to blogs and community sites can be found in the last tabulator.
We have several ways to add content to Virtual Earth. Of course we can directly add addresses or business listings from a search within Virtual Earth but we can also add data from different sources. To do so we need to understand the objects in Virtual Earth. The top-level object is the VEMap. To a VEMap-object we can add one or more VEShapeLayers to which again we can add one or more VEShape-objects of type Pushpin, Polyline or Polygon. Each of these VEShapeLayers and VEShapes can have a z-index to control which one is on top, from a visual perspective.
Besides adding individual VEShape-objects to a layer we can also import complete datasets from GeoRSS-feeds or from KML, KMZ or GPX-files. GeoRSS is a modification to the well known Real Simple Syndication (RSS) which adds another tag for point, polyline or polygon information. The Keyhole Markup Language (KML) or the compressed (zipped) version of it (KMZ) had originally been developed for a product called Keyhole which is known today as Google Earth. This markup language is currently being standardized by the Open Geospatial Consortium (OGC) and is already very common. GPX is a XML format for waypoints, tracks and trails, used by many GPS (Global Positioning System) devices.
The simplest way to create your own tile data source is to use the MapCruncher. It allows you to manually georeference an image by defining map-correspondence points. You load an image into the workbench and move a distinct point under the crosshair in the left window. Then you move the related location in Virtual Earth under the crosshair in the right window and once you have a few points (at least 3) you can lock the view which re-projects the image so that it fits to the geography. Now the MapCruncher can do its main work and cut down the image in pyramid layers and tile structures which follow the Virtual Earth naming convention.
Once you have the tiles you just have to put them into a virtual directory on your web server and then you can call the method VEMap.AddTileLayer to overlay these tiles on top of the Virtual Earth base-layers. Don’t worry about the details of this method for now – we will discuss that a little bit later in more detail when we actually use it. Below you find a graphics of the principle: When the application loads in the client’s browser it will get the skeleton of the website form your web server but it loads the Virtual Earth map control and the Virtual Earth tiles from the Microsoft data centers. To overlay your own custom tile layer it will contact your web server again and retrieve those tiles which have the same name as the ones which are currently displayed.
(to be continued)