Click to Rate and Give Feedback
MSDN
MSDN Library
Windows Live
Virtual Earth Developer Community FAQ

Welcome to the Virtual Earth Developer Community FAQ. The purpose of this FAQ section is to enable participants from the developer community to ask and answer questions about developing solutions with Virtual Earth, to showcase their innovations, and to generate and maintain content through consensus.

The FAQ should not be used to report defects, suggest new features, or request technical support for this product; please visit our Forum on MSDN for these types of issues. For the latest news for Virtual Earth developers, please visit us on Windows Live Dev and read our developer Weblog.

Please remember that this is a community resource for developers with a wide variety of backgrounds, experience levels, and interests. Please respect the contributions of others and follow the MSDN Wiki Code of Conduct.

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
How To's on the Via Virtual Earth Wiki      Federico Raggi - MSFT ... infopete   |   Edit   |  

Via Virtual Earth has a wiki site with many interesting how to articles. Here is a partial list of article titles available. Check the Via Virtual Earth wiki to see the articles or the complete list:

  • Degrees Minutes Seconds to Decimal Degrees
  • Dispose the map on exit
  • Draw a circle given a lat/long and radius (in miles)
  • Draw a filled circle given a lat/long and radius (in miles)
  • Finding a location and a custom Disambiguation box.
  • Make VE work in FireFox 2
  • Full screen support. Resizes with your browser.
  • Hide the message boxes
  • IIS compression
  • JavaScript optimisation
  • Kernel mode caching
  • Use metric Kilometres
  • Live.com Gadget with Virtual Earth map
  • Load VE control without body onload
  • Preloading message for VE JavaScript
  • Support for Controls in 3D mode
  • Use live search from code

Link to Via Virtual Earth Wiki: http://viavirtualearth.com/Wiki/Welcome.ashx

Tags What's this?: 3d (x) Add a tag
Flag as ContentBug
Discover the user location (latitude and longitude)      Federico Raggi - MSFT   |   Edit   |  

Summary

JavaScript code that discovers the latitude and longuitude of a user visiting a web page and centers a map around it.

Summary of Steps

  • Copy the template code and paste it into your application.
  • Invoke GoToUserLocation() from your application.


Notes :

GoToUserLocation should be called after the Virtual Earth mapping control has loaded
Replace the 'map' object name on SetAutoLocateViewport by the name of the map object in your application.

How the code works:

The JavaScript code consist of three functions:

  1. GoToUserLocation(): Invokes the remote Virtual Earth WiFi service by:
    • Dynamically creating an HTML <script> tag
    • Setting the 'src' (source) property of the <script> tag to the Virtual Earth WiFi service URL
    • Appending the <script> tag to the page DOM tree. By appending the <script> element, we force the execution of the code pointed by the 'src' property, in this case the Virtual Earth WiFi service.
  2. SetAutoLocateViewport(latitude, longitude, lvl, bl, msg): Centers the map around the latitude and longitude parameters passed to it. The Virtual Earth WiFi service invokes this function passing the user latitude, and longitude as first two parameters.
  3. ShowMessage(msg): Displays an error message. The Virtual Earth WiFi service calls this function if it can't find the user location.

Template Code

    
// WiFiLocator.js
// --------------
// Finds current user latitude and longitude location using Virtual Earth's WiFi location service
//
  // URL of Virtual Earth's location service
var WiFiLocatorUrl = " http://virtualearth.msn.com/WiFiIPService/locate.ashx "
  // GoToUserLocation() invokes the remote Virtual Earth WiFi service by 
// dynamically creating a <script> tag that points to the URL of the WiFi service
  function GoToUserLocation()
{
// Dynamically create <script> tag
oScript = document.createElement("script");
         // Set the 'src' property of the <script> tag to the URL of the Virtual Earth WiFi service
oScript.setAttribute("src", WiFiLocatorUrl);
         // Append the <script> tag to the HTML page DOM tree. 
// This forces the execution of the remote script pointed by the 'src' property,
// in this case, the Virtual Earth WiFi service.
head = document.getElementsByTagName("head").item(0);
head.appendChild(oScript);
}
  // SetAutoLocateViewport() centers the map to the latitude and longitude passed to it as parameters. 
// This function is invoked by the Virtual Earth WiFi service passing the latitude and
// longitude as the firts two parameters.
  function SetAutoLocateViewport(latitude, longitude, lvl, bl, msg)
{
// Creates a Virtual Earth Latitude/Longitud object...
var latLong = new VELatLong(latitude, longitude);
       // ... and centers the map around it
map.SetCenterAndZoom(latLong, 12);
}
  // ShowMessage() is called by Virtual Earth WiFi service if it can't find the user location 
  function ShowMessage(msg)
{
alert("Couldn't find user latitude and longuitude:" + msg);
}

I got the idea for this how-to from an article written by Yousef El-Dardiry and published on Via Virtual Earth.


Tags What's this?: Add a tag
Flag as ContentBug
How to Add the Virtual Earth 3D Map Control v6 to a Visual Studio Windows Forms Application      asansone ... Thomas Lee   |   Edit   |  

I have searched most of the internet on how to add a Virtual Earth 3D Map Control in a Windows Forms Applications and have had no luck with the new Version 6 Map Control. The easy way people are adding the control to a Windows Forms Application is through a Web Browser Control in the Tool Box and just linking the destination (iFrame) URL.

VE Map Javascript Locale      Italian Cousin   |   Edit   |  
I noticed that the ASP.NET control version of VEMap has got a property called Locale which accept SupportedLocales like en_us, it_it etc. and it seems to work.

Where is this option in the javascript API?


Flag as ContentBug
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker