Well, well, well what have we here? We now have access to one of the highest resolution global satellite imagery and aerial photography collections (460 million sq. km. + 1 million sq. km. per day moving forward) through a deal we've just struck with DigitalGlobe. We'll finally be able to backfill areas around the world where people have come to my blog and complained about Virtual Earth not having good imagery or photos in their countries - Poland, Hungary, Russia, Taiwan, Mexico, to name a few - I've heard you loud and clear. And, now, we're fixing that problem. Read the press release below:
DigitalGlobe Announces New Content Partnership for Virtual Earth With Microsoft Longmont, Colo., October 7, 2008 – DigitalGlobe, a leading global content provider of high-resolution world imagery solutions, today announced that it has signed an agreement with Microsoft Corp. for a multi-year contract under which DigitalGlobe will provide Microsoft’s Virtual Earth with its premium, high-resolution satellite and aerial imagery. Under the terms of the agreement, Microsoft will have access to DigitalGlobe’s vast ImageLibrary, which contains over 460 million square kilometers of premium earth imagery, as well as new images being collected every day by its growing constellation of satellites. “DigitalGlobe’s strategic approach to collecting earth imagery allows us to provide our customers with the high-resolution content they need,” said Erik Jorgensen, corporate vice president of Virtual Earth at Microsoft. “With its growing constellation of satellites, large network of aerial partners and a proven track record for delivering a large volume of new earth imagery, DigitalGlobe will be a key content partner for the Virtual Earth Platform.”
DigitalGlobe has been the pioneer in making earth imagery available worldwide for web portals and mobile mapping applications. Its high-resolution satellite constellation and aerial program collect nearly 1 million square kilometers of earth imagery each day, with much of this imagery available via its online services.
“We are proud to partner with one of the world’s great technology companies,” said Marc Tremblay, senior vice president and general manager of DigitalGlobe’s Commercial Business Unit. “We look forward to working with the Virtual Earth team in the years to come as they continue to expand this powerful geospatial platform.”
CP
I haven't talked about WorldWide Telescope since it launched; but, since Microsoft Virtual Earth is a part of that Microsoft Research project I thought it would interest some of you that we decided to include some of the WorldWide Telescope into Virtual Earth. Did you know that the Virtual Earth data centers host all of the data for WWT and that the actual Earth in WWT are Virtual Earth tiles? Well, now you do.
So, what did we take from WWT? The constellations. More specifically, the stars. In the latest release of the Virtual Earth 3D control, we included the accurate placement of stars in space. The stars are drawn leveraging the Hipparcos catalogue and differ based on magnitude and color. The Hipparcos (HIgh Precision PARallax COlletion Satellite) catalogue is the de facto measurement of the stellar parallax and the proper motion of the stars.
Yes, I had to look up what the heck Hipparcos is, but don't you feel smarter now? And, maybe now you know something about Virtual Earth that others don't. As a reminder, you can download WorldWide Telescope for free online.
U-Haul just made the move from MapQuest to Virtual Earth. Actually, U-Haul has been a long-standing MapPoint Web Service customer for several applications and they've decided to move over their Location Finder over to Virtual Earth - sweet. Hey, where do you think that whole "Mom's Attic" name comes from for that area over the driver's cabin? Either way, it makes for some great jokes of where the mother-in-law sits during the move.
Their location locator features an open search box allowing you to put in a postal code, city name or whatever you want to get a result (Virtual Earth flexible like that) and find the nearest U-Haul dealer to you. You can select from a few different amenities - trucks, storage, boxes, trailers, hitches and propane (propane, who knew?!?).
Like I've said in the past, everyone has to have a little custom spin on their locator, so in addition to the things you would expect - radius searching, contact information, a map, driving directions - U-Haul has added the ability to click through to get equipment rates for each store. So, basically, "Here's the store you're looking for, now would you like some equipment?" A direct link to e-commerce. That is The Goal, right? Make money? You can go through the process - from the locator - to pick the truck you want (one way or round trip) on the date you want at the price you want with the equipment you want...see where I'm going - what you want, where you want, when you want it? Why don't more people link e-commerce to the store locator? Or, better yet, add the store locations into the e-commerce system so you can tell users "Yes we have what you're looking for and THIS store has it right now, so bring us your money (right now)." Seems like a no-brainer.
Thanks to everyone who attended my "Momentum Webcast: See More and Do More with Microsoft Virtual Earth (Level 100)" this morning. If you missed the webcast (shame on you), you can view the recording online at the Live Meeting Website. For additional information about the Virtual Earth AJAX Control 6.2 or the Virtual Earth Web Service, check out my post titled, "Announcing The Virtual Earth Web Service and Virtual Earth Map Control 6.2" for a full run down of the feature set.
During the web cast, I mentioned a few "less than highly advertised features." I wouldn't call them Easter Eggs, they just pertain more to developers than higher level decision makers. The features are as follows:
For those of you who were wondering about the mysterious white paper that was mentioned in the email, we've posted a MSDN Technical Article explaining how to integrate the Virtual Earth Web Service into a Silverlight user experience - "Developing a Silverlight Application Using Virtual Earth Web Services." It's a long one, so get some diesel in you before you sit down with it. Also, don't forget about Mark Brown's 6.2 Technical Webcast Friday morning.
I couldn't think of a good way to break these apart, so I developed both imagery metadata (date of photography / imagery acquisition) and reverse geocoding (converting coordinates to the nearest address) together. Actually, I can think of many ways to get the reverse geocoding working without the imagery metadata - I did so in my "Getting Addresses Using Aerial Photos" post, but with the introduction of imagery metadata in our latest release, that is, getting some date information about when the ortho photography (not Bird's Eye) was captured I had to make something cool. So here it is. I need a place to host my ASP .Net applications to show them off. I'm frustrated. When I figure out what's wrong with my Win ISP account, I'll post them - I promise.
The application I wrote allows you to right-click anywhere on the map and (with the aerial map style) you can get the date photography/imagery was captured (as a range), the latitude and longitude coordinates of the pixel clicked, and subsequently the geocodes reversed to an address including the precision type - either interpolated or rooftop.
A couple things you should know. (1) The imagery metadata method will only work if you have a valid production token - staging tokens will not work. (2) In order to have production access you must have a licensed version of Virtual Earth - send mail to the Virtual Earth Licensing Team to get a license. This means there are now 3 methods that only work if you're licensed to use Virtual Earth and NOT part of the free API (traffic flow data and exposed route geometry, being the other two).
With that in mind, let's do this. I have 3 files, but I'm going to show you 2. The third file is Authentication.cs which gets my token and you can read all about in my Authentication and Tokens with Virtual Earth post. The other two files are Metadata.aspx (for the UI) and Metadata.aspx.cs (as the code behind - filled with magic).
Metadata.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="MetaData.aspx.cs" Inherits="MetaData" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <!-- saved from url=(0014)about:internet --> <title>CP's Meta Data & Reverse Geocoding Page</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script type="text/javascript" src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2"></script>
<script type="text/javascript"> //Variables var map = null; var locations = null; var pixel = null; var clickEvent = null; var LL = null; //Get token from code behind var token = "<%=strClientToken %>";
//Geocoding for the input box function FindLocation() { map.Find(null, txtGeocode.value); }
//Get Map & Token function GetMap() { map = new VEMap('myMap'); //Load Map Onto Map map.LoadMap(new VELatLong(33.79965996889632, -116.42153441905977), 17, VEMapStyle.Hybrid); //Set token map.SetClientToken(token); //Attach an event for when user right clicks map map.AttachEvent("onclick", PixelClick); map.onLoadMap = GetVintageInfo(); }
//Right click event handler function PixelClick(e) { if (e.eventName == 'onclick') { if (e.rightMouseButton) { var x = e.mapX; var y = e.mapY; pixel = new VEPixel(x, y); LL = map.PixelToLatLong(pixel); map.FindLocations(LL, GetResults); GetVintageInfo(); } } }
//Callback for getting vintage information var vintageStart; var vintageEnd; var vintage; function GetVintageInfo() { vintage = function(data) { var v = data; vintageStart = data.DateRangeStart; vintageEnd = data.DateRangeEnd; }; //Set options for imagery data var vintageOptions = new VEImageryMetadataOptions(); vintageOptions.LatLong = new VELatLong(); vintageOptions.LatLong = LL; //Make request to service to get vintage information map.GetImageryMetadata(vintage, vintageOptions); } //Reverse Geocoding & Vintage Information - Magical Delight function GetResults(locations) { //strOutput is the string info in the pushpin popup var strOutput = ""; //precision is a string info for geocode type var precision = ""; if (locations) { strOutput += "Imagery Capture Date Range: <br/>" + vintageStart + " -<br/>" + vintageEnd + "<br/><br/>"; //Loop through results and place them in the pushpin popup for(var i=0;i<locations.length;i++) { if (locations[i].Precision == VELocationPrecision.Interpolated) { precision = "Interpolated"; } else { precision = "Rooftop"; } strOutput += "Address: "; strOutput += locations[i].Name; strOutput += "<br/>Lat: " + LL.Latitude + "<br>Long:" + LL.Longitude strOutput += "<br/>Geocoded Method: " + precision; strOutput += "<hr/>"; var myPushpin = new VEShape(VEShapeType.Pushpin, LL); myPushpin.Title = strOutput; myPushpin.SetDescription = strOutput; //Get Vintage information based on Lat/Long of clicked point map.AddShape(myPushpin); } } else { alert('No Result found.'); }
}
//Clear all pins from the map function ClearPins() { map.DeleteAllShapes(); }
</script> </head> <body onload="GetMap();"> Geocode: <input type="text" name="txtGeocode" size="30"/><input type="button" value="Find!" onclick="FindLocation();"/> <div id="myMap" style="position:relative; width:1000px; height:600px;"></div> <br/><input type="button" value="Clear Pins" onclick="ClearPins();"/><br/> </body> </html>
MetaData.aspx.cs
using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using VEWSStaging;
public partial class MetaData : System.Web.UI.Page { public string strClientToken; protected void Page_Load(object sender, EventArgs e) { strClientToken = Authentication.Authenticate(Page.Request.UserHostAddress); }
As you can see, most of the code happens in the ASPX file, as opposed to the ASPX.CS file because we're using the AJAX control. My recent VEWS posts are the flip of that allowing .Net developers to leverage their knowledge and still get maps and aerial photos for their applications without worrying about JavaScript. Or, you could be cool like me and do both! Someone called me a narcissist today!!! WTH??
The code is fairly well documented, but feel free to ping me with questions. For those who want to know, yes the imagery data and reverse geocoding are both available in the Virtual Earth Web Service, as well (production only, for metadata).
For those of you who may want to get access to the 85 million unique rooftop or parcel centroid accurate points we've aggregated in the Virtual Earth Web Service (VEWS), I figured it was only fair that I post a little something to help move you along. Hopefully, this helps you get past a sticking point in your application development. Also, I did all of this on staging so everyone who has an account can do this.
Okay, so, first things first, you need to authenticate - see my post Authentication and Tokens with Virtual Earth for authentication. You'll need a token to use any part of the VEWS and there's a good explanation on how to do that for VEWS in my other post (and information on getting a map) - Getting a Map with the Virtual Earth Web Service, but I'll copy the code to be nice.
The application consists of 3 files - Authentication.cs (a class file for getting me a token); Geocoding.aspx (the UI file for adding web parts); and, Geocoding.aspx.cs (the code behind file where the magic happens). As for my code, it's only meant to get you up and running to understand architecture - it is not production code. You'll want error handling and try catches and all the good stuff - this is just the meat and potatoes.
Authentication.cs
using System; using System.Data; using System.Configuration; using VEWSStaging; //VEWS is a reference to http://staging.common.virtualearth.net/find-30/common.asmx
/// <summary> /// Authenticating for VE Tokens /// </summary> public class Authentication { public static string strVEWSToken; public static string Authenticate(string strIP) { CommonService commonService = new CommonService(); commonService.Url = "https://staging.common.virtualearth.net/find-30/common.asmx"; commonService.Credentials = new System.Net.NetworkCredential("XXXX", "YYYY");
// Create the TokenSpecification object to pass to GetClientToken. TokenSpecification tokenSpec = new TokenSpecification();
// Use the Page object to retrieve the end-client’s IPAddress. tokenSpec.ClientIPAddress = strIP;
// The maximum allowable token duration is 480 minutes (8 hours). // The minimum allowable duration is 15 minutes. tokenSpec.TokenValidityDurationMinutes = 480;
// Now get a token from the Virtual Earth Platform Token service. strVEWSToken = commonService.GetClientToken(tokenSpec); return strVEWSToken; } }
Next, I'll need to set a reference to the geocoding service (WCF) - Website | Add Service Reference. I named my service "GeocodeService" which you can see has two methods - Geocode and ReverseGeocode.
Next, we'll need to add UI elements to Geocoding.aspx. I added a Label (as a title), a Text box (to input addresses or places), a Button (to submit the data) and a Table (to store the results). When I'm done, Geocoding.aspx looks like this...
Geocoding.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Geocoding.aspx.cs" Inherits="Geocoding" %>
<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>CP's Geocoding Page</title> </head> <body> <form id="form1" runat="server"> <div> Enter a location</div> <asp:TextBox ID="TextBox1" runat="server" Height="20px" Width="375px"></asp:TextBox> <asp:Button ID="Button1" runat="server" Height="21px" onclick="Button1_Click" Text="Geocode!" Width="80px" /> <asp:Table ID="Table1" runat="server" Height="475px" style="margin-top: 0px" Width="500px"> </asp:Table> </form> </body> </html>
And now for the magic. We'll use these elements to make a service request to VEWS to submit the data in the text box and geocode the location. I'll take the entire response and break up each part so you can see most of what gets returned in the response. Make sure you add a reference to the GeocodeService we added above.
Geocoding.aspx.cs
using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using GeocodeService;
public partial class Geocoding : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) {
} protected void Button1_Click(object sender, EventArgs e) { //Get user IP for token string token = Authentication.Authenticate(Page.Request.UserHostAddress); //Instantiate geocode request GeocodeRequest myGeocodeRequest = new GeocodeRequest(); //Instantiate credentials for geocode request myGeocodeRequest.Credentials = new GeocodeService.Credentials(); //Add token to geocode request myGeocodeRequest.Credentials.Token = token; //Using GeocodeRequest.Query so we don't need a structured request - just single box myGeocodeRequest.Query = TextBox1.Text; //Instantiate confidence filter - I just want one filter ConfidenceFilter[] myConfidenceFilter = new ConfidenceFilter[1]; //Instantiate filter myConfidenceFilter[0] = new ConfidenceFilter(); //!Had to specify Geocode Service because Confidence is defined also in Imagery Service! //Setting confidence to low so I get maximum results myConfidenceFilter[0].MinimumConfidence = GeocodeService.Confidence.Low; //Instantiate Geocode options GeocodeOptions myGeocodeOptions = new GeocodeOptions(); //I only want at most 5 results myGeocodeOptions.Count = 5; //Pass in my confidence filter myGeocodeOptions.Filters = myConfidenceFilter; //Pass in my geocode options myGeocodeRequest.Options = myGeocodeOptions; //Instatiate geocode service client for connection to VEWS GeocodeServiceClient myGeocodeServiceClient = new GeocodeServiceClient(); //Physically making VEWS request! GeocodeResponse myGeocodeResponse = myGeocodeServiceClient.Geocode(myGeocodeRequest); //Loop through results to pull out response and put into a table //I'll only get 1 response, but it could have multiple results for(int i = 0; i < myGeocodeResponse.Results.Length; i++) { TableRow tRow = new TableRow(); Table1.Rows.Add(tRow); TableCell tCell0 = new TableCell(); tCell0.VerticalAlign = VerticalAlign.Top; tRow.Cells.Add(tCell0); tCell0.Text = "Formatted Address = "; tCell0.Text += myGeocodeResponse.Results[i].Address.FormattedAddress; tCell0.Text += "<br> Address Line= "; tCell0.Text += myGeocodeResponse.Results[i].Address.AddressLine; tCell0.Text += "<br> Locality = "; tCell0.Text += myGeocodeResponse.Results[i].Address.Locality; tCell0.Text += "<br> Admin District = "; tCell0.Text += myGeocodeResponse.Results[i].Address.AdminDistrict; tCell0.Text += "<br> Postal Code = "; tCell0.Text += myGeocodeResponse.Results[i].Address.PostalCode; tCell0.Text += "<br> Country = "; tCell0.Text += myGeocodeResponse.Results[i].Address.CountryRegion; tCell0.Text += "<br> District = "; tCell0.Text += myGeocodeResponse.Results[i].Address.District; tCell0.Text += "<br> Postal Town = "; tCell0.Text += myGeocodeResponse.Results[i].Address.PostalTown; tCell0.Text += "<br> Confidence = "; tCell0.Text += myGeocodeResponse.Results[i].Confidence; tCell0.Text += "<br> Display Name = "; tCell0.Text += myGeocodeResponse.Results[i].DisplayName; tCell0.Text += "<br> Entity Type = "; tCell0.Text += myGeocodeResponse.Results[i].EntityType; tCell0.Text += "<br> Altitude= "; tCell0.Text += myGeocodeResponse.Results[i].Locations[i].Altitude; /* If there are multiple response types, the latitude, longitude and * Calculation methods will have more than one result in their array. This * is where you'll want to differentiate them to use either interpolated, * rooftop or parcel centroids depending on how accurate you want them. */ for (int j = 0; j < myGeocodeResponse.Results[i].Locations.Length; j++) { tCell0.Text += "<br> Latitude = "; tCell0.Text += myGeocodeResponse.Results[i].Locations[j].Latitude; tCell0.Text += "; Longitude = "; tCell0.Text += myGeocodeResponse.Results[i].Locations[j].Longitude; tCell0.Text += "; ("; tCell0.Text += myGeocodeResponse.Results[i].Locations[j].CalculationMethod; tCell0.Text += ")"; } } } }
The end results is a nice little parsing of some address information returned from VEWS:
There isn't any difference in the geocoding results you get back between VEWS and the Virtual Earth AJAX control. Both now have rooftop and parcel centroid geocoding points totaling 85 million in the United States. Now, if I can just figure out what's up with the space between my text box and my table....[FIXED - tCell0.VerticalAlign = VerticalAlign.Top; ]
We're looking for a few good 3D designers to submit their best 3D work in Microsoft Virtual Earth (or Live Search Maps). A new addition to the Caligari (trueSpace) 3D Authoring and Collaboration site is a Virtual Earth Gallery specifically dedicated projects with geolocation in mind. You can browse through user submitted 3D objects to place them in your collection in Live Search Maps. For more information on how to do this, you can review my post - Announcing trueSpace for Virtual Earth 3D Development - please note trueSpace 7.6 is FREE. Don't pay for it on some rip off web site - Register and Download trueSpace 7.6 for free. In addition to my post, the Caligari team has improved some of their own documentation explaining Windows Live ID and some finer details about the integration with a Virtual Earth and trueSpace primer.
Also, we've setup a monthly trueSpace / Virtual Earth integration contest to up the ante, as it were. We hope to see some really cool 3D models uploaded into Live Search Maps as a part of this effort. The movie above was submitted by Stephen May, our first winner (August, 2008) whose "Wizitch Tower" model is a beautiful addition to Live Search Maps' Collections and placed quite nicely in Christchurch, New Zealand. You'll also see his "Rocketship" and "LaunchTower" in the video - equally impressive. You can view these 3D collection items in Virtual Earth 3D if you'd prefer.
How can you submit your models for the trueSpace Virtual Earth Contest? Here are the rules:
Each month, send in your Virtual Earth creations made in trueSpace for a chance to win a prize! All selected entries will be put on display, promoting your work to the millions of visitors who drop by the Caligari website each month.
Well? Let's see whatcha got.
The most basic element of Virtual Earth - maps. The Virtual Earth AJAX control is pretty simple because you could just copy and paste code into notepad, save it and run it in a browser. Well, the Virtual Earth Web Service (VEWS) is a bit of a different animal. It uses WCF and WSDL to specify service pointers of where you should be getting maps, directions, YP and Collections, and routes. I figured it would be helpful, what with my deep background in MapPoint Web Service which has a similar architecture, to provide some help on how the Virtual Earth Web Service works. So, over the next few weeks I'll post some (hopefully) helpful samples that will get you past some sticking points. We'll start with just getting a map. I should mention that because I work at Microsoft, these samples will be in ASP .Net (C#), so hopefully understanding the logic will help you translate to whatever language you're working with. If you only do JavaScript / Web Development, you're going to need some more books, because you have some learning to do.
With the VEWS, it is required that all users authenticate. So, you'll need to sign up for a developer account, then authenticate your usage with our HTTP Digest authentication scheme.
First thing we'll need to do is add the Imagery Service. This uses Windows Communication Foundation (WCF), which is "a set of .NET technologies for building and running connected systems. It is a new breed of communications infrastructure built around the Web services architecture." Ohhh, scary. Uh, no. Basically, it makes it easier for you to not have to worry about where to make your service calls to.
Add the Imagery Service You can add the imagery service in Visual Studio by going to Website | Add Service Reference and entering the imagery service URI into the address box, then hitting go. It should pull up the reference points in the service with two supported methods (aka Operations) - GetImageryMetaData() and GetMapUri(). Give it a name at the bottom - I named mine ImageryService.
Add New Web Form You'll need a web page to contain your map, so add a web form to your project - Website | Add New Item | Web Form. I named mine Map.aspx.
Add Image to Your Web Form VEWS returns the URI for a map image. So, you'll want to have an image placeholder there. Do this by dragging an image object from the toolbox onto your web form. You can resize it to the size you need by dragging the corners.
Authenticate I'm not going to show you how to authenticate here, but I thought it important to point something out. Although this is a server request, the authentication still requires a token. That wouldn't be a challenge, but the token requires the user's IP so here's how to do it.
I create a class called "Authentication.cs"
In the class I put the authentication I wrote about in my Authentication and Tokens with Virtual Earth post except for one change.
using VEWSStaging;
/// <summary> /// Authenticating for VE Tokens /// </summary> public class Authentication { public static string strVEWSToken; public static string Authenticate(string strIP) { CommonService commonService = new CommonService(); commonService.Url = "https://common.virtualearth.net/find-30/common.asmx"; commonService.Credentials = new System.Net.NetworkCredential("XXXX", "YYYY");
We'll get the IP in the from the Maps.aspx page in the next step.
Requesting a Map Now, I used most of the code from the SDK so it would help you longer term - teach a man to fish..... Also, I don't use error handling, so for production applications you definitely want to add checks. Here's the code that works for authenticating via my Authentication Class and passing the IP (UserHostAgent) to get the token (yes, token is required). I set the options for the map (center point, zoom level, map style, image height and image width) then request the URI for the map. You'll pass that URI down into the image you dropped on your web page, and you're done!
Map.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Map.aspx.cs" Inherits="Map" %>
<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>VEWS Map</title> </head> <body> <form id="form1" runat="server"> <div> </div> </form> <asp:Image ID="Image1" runat="server" Height="480px" Width="600px" /> </body> </html>
Map.aspx.cs
using System; using System.Collections; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using ImageryService;
public partial class Map : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { string myToken = Authentication.Authenticate(Page.Request.UserHostAddress); ImageryService.MapUriRequest myMapURIRequest = new MapUriRequest(); myMapURIRequest.Credentials = new ImageryService.Credentials(); myMapURIRequest.Credentials.Token = myToken; myMapURIRequest.Center = new ImageryService.Location(); myMapURIRequest.Center.Latitude = 37.42196783438708; myMapURIRequest.Center.Longitude = -122.084039747715;
ImageryService.MapUriOptions myMapURIOptions = new ImageryService.MapUriOptions(); myMapURIOptions.Style = ImageryService.MapStyle.AerialWithLabels; myMapURIOptions.ZoomLevel = 17; myMapURIOptions.ImageSize = new ImageryService.SizeOfint(); myMapURIOptions.ImageSize.Height = (int)Image1.Height.Value; myMapURIOptions.ImageSize.Width = (int)Image1.Width.Value;
myMapURIRequest.Options = myMapURIOptions;
ImageryService.ImageryServiceClient imageryService = new ImageryService.ImageryServiceClient(); ImageryService.MapUriResponse myMapURIResponse= imageryService.GetMapUri(myMapURIRequest); string MapURI = myMapURIResponse.Uri;
Image1.ImageUrl = MapURI; } }
I did this in the Page_Load method, but you can certainly request a map from any web form object and event. When it's all said and done, you get this lovely aerial photo with labels returned to you in .JPEG format and rendered onto a blank page. You'll want to just build your application around it as needed.
I've been getting the question recently about the advantages of VEWS over AJAX. Perhaps this is a post in and of itself, but from a feature perspective:
SOAP is so clean.
Ok, so let's just jump in with both feet here. I have a post for "Getting a Map with the Virtual Earth Web Service" to tip your toe in the water, but with all of the emails I'm getting about this I better go ahead and just write it up and get it out there so I can just point people to it. This will be an architectural overview to get you started. I haven't written the code, my iPhone is on order, and my Objective-C needs work, but for the folks who are building iPhone applications and saw Loopt and Weather Central's applications and saw my post about Announcing The Virtual Earth Web Service and Virtual Earth Map Control 6.2, well, it's time to party on iPhone.
"This is so exciting!" - Craig Robinson, Pineapple Express.
Sign Up & Documentation First things first, you'll need a Virtual Earth Web Service developer account to get started so go sign up. VEWS is fully documented on MSDN, so you'll want to have that accessible. Also, it is downloadable as a .chm file if you don't want to have to look online all the time.
Coding - 4 Major Steps (1) First, you'll need to authenticate against the Virtual Earth Web Service (VEWS) so, you'll want to review the MSDN technical article on Implementing Customer Identification and my post on Authentication and Tokens with Virtual Earth if you run into problems.
(2) Next, you'll make a request to the ImageryService in VEWS. Within the ImageryService you can access the quad keys (aka Tile IDs) for the Virtual Earth tile pyramid. Tile IDs are needed to construct URIs used to request map tiles from Virtual Earth. The ImageryServiceClient.GetImageryMetadata Method returns tile URIs in the ImageryMetadataResult.ImageUri Property. When you request your tiles, you'll pass in a CenterPoint (Latitiude, Longitude), ZoomLevel (1-21) and MapStyle (Aerial, AerialWithLabels, BirdsEye, BirdsEyeWithLabels, Road). YES - YOU CAN GET BIRD'S EYE TILES VIA THE VIRTUAL EARTH WEB SERVICE!!!! Can you picture how cool it is looking at a Bird's Eye image of a location on your iPhone? Holy smokes! Back to constructing the application....
(3) In the CommonService, you’ll set the Device Type to specify the mobile map tiles and build out your control for the specified device for client applications.
(4) Wrap the response up into your Objective-C client application for iPhone and you've got your base map in the client. Add drawing tools and pushpins, and you've got some interaction. If you have a license, you can extract route geometry via the RouteResult.RoutePath Property in the RouteResult Class the and render the points on your device.
WAP If you’re building out WAP applications, you can request a static .png, jpg or gif in the ImageType Enumeraton and render it on the device’s browser. By default, the Aerial and Bird's Eye images are returned as .jpeg and road tiles are returned as .gif. If you want to retrieve a URL to a complete static map, use the ImageryServiceClient.GetMapUri Method instead and push into your IMAGE URL HTML tag.
Could this be any more exciting? I think not! When you're done building your iPhone app, let me know and I can showcase it on my blog.
If you follow Microsoft Virtual Earth I'm sure you've picked up some blog posts that posted some of the features for this release, but those posts mysteriously disappeared. Information leaked out and you wondered, "Was that real?" Well, finally the definitive source on the new Virtual Earth Web Service and the new Virtual Earth Map Control 6.2 I deliver to you. If you want to skip the descriptor and just get coding you'll be happy to know the Virtual Earth AJAX Control SDK on MSDN, as well as, the Virtual Earth Interactive SDK have both been updated.
New Mobile Support Users can now build mobile applications with Virtual Earth, which offers more features and enhancements to support mobile platforms such as, Windows Mobile, RIM Blackberry and Apple iPhone. Rich imagery creates immersive mobile end-user experiences that bring location-based information to life.
Enhanced International Opportunities This latest release of Virtual Earth provides more support and more detail for more countries around the world. Enjoy the functionality and features of Virtual Earth in a broader range of countries.
Richer Data: See More in the Platform The Virtual Earth platform is designed for the enterprise and public sector user, from features to support. This 6.2 release enhances the platform infrastructure with new geocoding and parsing improvements, as well as more detail revealed in relevant ways.
Enhanced Functionality: Do More in the Platform The latest release of the Virtual Earth platform offers a richer user experience and more intuitive functionality. There are more ways for customers to search for more types of mapping information, in ways that are tailored to their individual needs.
Don't forget about my October 2 "Momentum Webcast- See More and Do More with Microsoft Virtual Earth (Level 100)" covering the release. Also, tune in to Mark Brown's Webcast diving a little deeper into the code on October 3.
Maybe we should take the old Vista marketing campaign - WOW. Mmm, maybe not. How about, I'm a PC VE! Ah, well.
We've just made updates to our consumer site, Live Search Maps which are tied back to some of the updates in the Virtual Earth platform - there's a slough of posts coming from me today! For the release we've included some AWESOME new features for users to enjoy, so please...enjoy!
Communities Community submitted collections are now indexed immediately after upload and can be searched seconds after they are created. In addition to this, we provide better overall information retrieval by using collections data to augment search results in the “business” scope in cases where limited or no business listings exist that meet the search criteria.
Local Search Vertical Search refinement - Searches can now be refined further through filters that become available based on what you search for. Hotels, Restaurants, and generic queries each have filters that you can use.
Related searches - Related categories and neighborhoods with result counts allow you to see how many results there are before selecting a related search. This is the first time we’ve expose aggregate counts on the results page. These will be present for many filters and related searches in future releases.
YPC Phase 1.5 - MSN Yellow Pages and Local Search Vertical page both have ads above and below
Details page The details page has moved to an inline layout (from the tabbed model in previous version). This allows much more content to be exposed via controls that users will interact with anyway (scroll bars) instead of hunting through the content for the tab.
In addition to the layout enhancements, we have a new control on the page called the scorecard. This scorecard is a different way of looking at user reviews. It extracts user sentiments for a specific set of attributes that are applicable to hotels and restaurants. You can view the average score for that attribute and dig into the user comments themselves.
Multi-Point Directions
Multipoint Driving Directions extends our historical point to point driving directions metaphor to allow multiple waypoints, or “stops”, along the path of the route. This enables you to generate a single set of directions for reaching multiple destinations. Common scenarios where you might find this valuable include running errands, visiting homes for real estate purchase, picking up and/or dropping friends, choosing an explicit route to arrive at a gathering or other multi-stop trips around your city, region, or country.
Landmark Hints In an effort to make driving directions more easily understandable, landmark “hints” are now provided at key locations along a route. These hints provide the user an additional piece of visual data when making a turn (TACO BELL on the corner), or provide a feedback mechanism that the user is on the correct path when traveling down a road.
Landmark hints are applicable to routes in North America and include the following types of businesses:
Geocoding Results for place searches (e.g. cities, states, countries, landmarks, etc.) have been improved, particularly for international queries.
Coverage for high precision geocoding has been increased. Address geocoding for the UK, France, Germany, Spain, and Italy has been improved, with dramatic improvements in unstructured match rates for queries in these countries.
Imagery Processing and Rendering
Vector Data (roads and places)