Archive for the ‘Bing Maps AJAX Control’ Category
Bing Maps and Hotmail come together
If you are using the web-client of Hotmail or Office Live you may already have discovered it: Hotmail integrates now with Bing Maps. When you create a new email, you can now insert various types of content from Bing, including Bing Maps:
When you select “Maps and Places” a task pane opens that allows you to add new locations or interact with a set of previously defined locations. By default you will find here the address that you entered in your Windows Live profile. If you add a new place you have the option to store it for later use in a Bing Maps Collection and quick pick it from the list as shown below.
Once you made a quick pick from the list or geocoded a new address you can optionally edit the details and then insert it into your email.
I think that’s a great idea. If only I could have that in Outlook too ![]()
Add Bing (Maps) to Your Safari Browser Extensions
A while back I blogged about Internet Explorer Accelerators that used Bing services for quickly highlighting text and performing subsequent searches (see, “Internet Explorer 8 Beta 2 Includes Virtual Earth”). Well, Apple’s Safari browser has extensions that allow 3rd party services, such as Bing, to add on capabilities such as Bing Search, Bing Travel and arguably most important Bing Maps.
If you have Safari installed, go to the Safari Extensions page and download the Bing Highlights extension (from within Safari). Once you’ve installed the Bing Highlights extender for Safari, you can go to any web page within the Safari browser, highlight an address with your mouse or touchpad and you’ll see a pushpin icon in the extender. Clicking the pushpin will load a Bing Map right within Safari with links to view the address in Bing Maps or get directions to or from the respective location. Alternatively, click the magnifying glass and you’ll see some options for searching Bing. Select “Search for a map” and you will be magically transported over to Bing Maps with the location geocoded and centered at the respective match. So, now we’ve made it so easy to get maps even if you’re on Safari with a simple select and click.
Also, in case you were wondering, you can switch your default search in the Safari browser (upper right) to Bing too. Just click the down arrow in the search box and select Bing. Get your browser all Bing’d out! To learn more about the Bing Extension for Safari, read up on the Bing Search Blog.
Follow me @BingMaps, ^CP
Overlaying Parcel Boundaries on Bing Maps
In coordination with Digital Map Products (DMP), developers can now easily overlay over 100 million US parcels to more easily identify boundaries between properties. Using a simple, native method in Bing Maps and DMP’s ParcelStream API with just 7 lines of code (yes, SEVEN) you can tap into this wonderful trove of parcel information. So, how is it done? Luckily, DMP even provides code samples and working applications that you can just copy, paste and run.
The sample below uses both Bing Maps Platform APIs (AJAX) and DMP’s ParcelStream API. To walk you through the logic…you’ll first load both APIs by linking through JavaScript script tags. You’ll instantiate the Bing Map control (LoadMap()), then assign the parcels' via DMP’s API onto a map tile layer (layer = new Dmp.Layer.TileLayer()), and overlay the layer onto Bing Maps (addLayer()). The sample includes a toggle button and navigation which are optional by provide additional benefits to the user.
<html>
<head>
<title>Adding Parcel Tile Layer with DMP API</title>
<link href="http://spatialstream.com/samples/css/Style.css" rel="STYLESHEET" type="text/css" />
<script src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2" type="text/javascript"></script>
<script src="http://parcelstream.com/api/DmpApi.aspx?map=Bing&host=parcelstream.com/&v=3" type="text/javascript"> </script>
<script type="text/javascript">
var layer = null;
var map = null;
window.onload = function() {
//Instantiate Bing Map instance
map = new VEMap('myMap');
map.SetDashboardSize(VEDashboardSize.Tiny);
map.LoadMap(new VELatLong(33.85, -117.8), 17, VEMapStyle.Aerial);
Dmp.Env.Connections["SS"].init("/dc1/_T80/219e3105-167c-4538-b449-2c8dddadb09d");
layer = new Dmp.Layer.TileLayer("ParcelTiles", "SS", "Dmp_License/ParcelTiles", {zoomRange:{min:16,max:20}});
map.addLayer(layer);
}; //window.onload
function toggleLayer()
{
layer.attr("visibility", document.getElementById('toggleLayer').checked);
}
</script>
</head>
<body>
<h2>
Adding Parcel Tile Layer with DMP API</h2>
<p>
Parcel boundary lines are displayed on the map below as a tile layer. Click the
Toggle Layer box to turn off/on
<br />
the parcel lines tile layer.</p>
<input id='toggleLayer' type='checkbox' name="Toggle Layer" checked='checked' onclick='toggleLayer()' />Toggle
Layer
<div id="myMap">
</div>
</body>
</html>
That’s it! I’m not sure they could’ve made it any easier. Developers can create a free 30 day account with DMP to test it out and considering it takes all of 5 minutes to create an app you’ll have 43,195 more minutes to convince your CTO to easily add parcel layers atop your Bing Maps application. The code above requires registration associated with your domain, so if it doesn’t run for you it’s because I’m using my key and you need to get your own.
Obviously, this will also work with the Silverlight control as a tile layer too, so if your preference is to use the Bing Maps Silverlight control you can reference the DMP API’s and pull the parcel layers into the Deep Zoom experience.
Of note, the Bing Maps team will be at the Inman Connect Real Estate Conference July 13 – 15 in case you want to talk shop. We have 3 speaking sessions for you to learn about Bing Maps.
Follow me @BingMaps, ^CP
REST Easy; Bing Maps Has You Covered
It was just 6 months ago that the Bing Maps Platform team officially launched support for the Silverlight control. This was in addition to the Bing Maps SOAP Service (via Windows Communication Foundation) and the AJAX Control that have been in use for years now. Today, we’re announcing a REST interface into those wonderful maps, aerial images, and geocoding and routing systems for your grubby coding hands to get all dirty. And, the beauty with REST is that you simply need to build URL queries and handle the JSON or XML responses. It’s quite beautiful actually and it’s essentially the way the WWW was architected, so the learning curve will be fairly flat. If you’re too excited to read on and want the SDK now, you can view it online or download it from the Bing Maps Platform site.
Okay, so here’s the scoop on the Bing Maps REST APIs. There are main 4 APIs that allow you to do Geocoding, Render Maps and Imagery, Calculate Routes and Perform Batch Geocoding. Let me break it down for you...
Locations API. The Locations API is for geocoding on the fly. So, in your application when a user enters an address you’ll want to hit the Location API to get a response. The Location API contains 3 main functions:
Location by Address – Pass in an address and we’ll send back a lat/lon pair.
Location by Point – Pass in a lat/lon pair and we’ll send back an address (reverse geocoding).
Sample: http://dev.virtualearth.net/REST/V1/Locations/47.64054,-122.12934?o=xml&key=BingMapsKey
Location by Query – Pass in a string (address or landmark) and we’ll send back a lat/lon pair.
Sample: http://dev.virtualearth.net/REST/v1/Locations/1 Microsoft Way Redmond WA 98052?o=xml&key=BingMapsKey
Imagery API. The Imagery API is for getting maps and aerial photos. When you’re ready to show a map of a location you will want to use the Imagery API. Also, the Imagery API grants you access to imagery metadata such as capture date and provider information.
Map – Getting a map image based on an address, landmark or lat/lon pair.
Sample (Road): http://dev.virtualearth.net/REST/V1/Imagery/Map/Road/space needle,seattle?mapLayer=TrafficFlow&key=BingMapsKey
Sample (Aerial with Labels): http://dev.virtualearth.net/REST/v1/Imagery/Map/AerialWithLabels/statue of liberty nyc?mapSize=800,600&key=BingMapsKey
Imagery Metadata – Getting imagery vintage or provider information based on a lat/lon pair.
Routes API. The Routes API is for calculating driving directions. The Routes API allows you to get route distance calculations, route geometry and step-by-step directions via driving, walking or traffic based algorithms. You can also pass in up to 25 points on your route to calculate a multiple stop route in a single request.
Route – Calculating a route.
Spatial Data API. The Spatial Data API is for batch geocoding. Batch geocoding lets you up load a file for processing addresses through our backend systems without having to make multiple requests using the Locations API. If you have thousands of addresses to geocode at one time, you’re better off using the Spatial Data API.
Upload Data – Creates a batch geocoding job and uploads data into the cloud for geocoding.
Check Job Status – Checks to see whether the job is complete.
Sample: http://spatial.virtualearth.net/REST/v1/Dataflows/e14b1d9bd65c4b9d99d267bbb8102ccf?key=b1c323ea234
Download Data – Once the job is complete, you’ll download the geocoded data.
The REST API also has contextual and cultural properties. Optionally, if you want to shorten the URLs you’re using, you can substitute many of them with acronyms. If you want to show maps in French instead of English, you can set the culture to fr-FR. Also note that all of the sample requests I provided have the “key=BingMapsKey” parameter appended to them. You will need a Bing Maps Key to do any development; but worry not! Keys are free for all to use for developing applications. Get a key in the Bing Maps Portal.
Bing Maps AJAX Control Update – We also enhanced the Bing Maps AJAX Control with some streamlined features and a stripped down mode for light mapping techniques. The new AJAX Control is version 6.3 and has the following changes.
Core functionality version of the map control. The Bing Maps AJAX Control is now available in both full functionality and core functionality versions. If you do not have advanced mapping needs, you can enhance the performance of your map control application by using the core version of the latest map control. Note the version number (v=6.3c) for the core control which is now a slimmed down 35kb!
Sample: <script charset="UTF-8" type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.3c&mkt=en-us"></script>
New Search and Geocode methods. The new VEMap.Search Method and the VEMap.Geocode Method provide an easier way to return the most accurate search results. The current VE.Find Method has like 11 arguments for making your request more specific. If you know what you want and would rather slim your request down to 3 (query, callback, options).
Sample (Geocode): map.Geocode(‘1 Microsoft Way, Redmond, WA’, findCallback, options);
Sample (Search): map.Search(‘Fish Tacos in San Diego’, findCallback, options);
Drag-able pushpins. With the latest version of the Bing Maps AJAX Control, your pushpins become drag-able by simply setting the VEShape.Draggable Property of the pushpin to true. There are also optional events associated with the dragging motion that you can capture and fire off additional events such as search queries or grabbing pixels to convert to lat/lons.
Sample:
var pushpin = null;
pushpin = new VEShape(VEShapeType.Pushpin, map.GetCenter());
pushpin.Draggable = true;
pushpin.onstartdrag = StartDragHandler;
pushpin.ondrag = DragHandler;
pushpin.onenddrag = EndDragHandler
All good stuff for you Bing Maps Platform developers! I certainly hope to see some cool applications coming from these new APIs. And, if you are a developer, don’t forget to check out the Bing Map Apps API that was also released today. The Bing Map Apps API allows you to submit your Silverlight application to be published on Bing Maps!
Follow me @BingMaps, ^CP
