Bing Maps V8

by Mary Branscombe

The latest Bing Maps control makes it easier to build more sophisticated mapping solutions. Mary Branscombe investigates.

HardCopy Issue: 69 | Published: May 31, 2016

Mapping isn’t just about getting directions while driving your car: a high proportion of business data includes geospatial information that’s useful for planning, asset tracking, customer service and business intelligence. The new V8 version of the Bing Maps control combines new features with a simpler way of working and a new release model that gives you access to both stable and experimental features, making it easier to build tools for your users that can unlock the value of such information.

You get the same maps and many of the mapping tools that Microsoft uses itself for apps like Maps and Photos on Windows 10, and on the Bing Maps website, in a control that uses HTML5 Canvas, which allows it to render vector data rather faster than previous versions. The emphasis on HTML5, JavaScript and CSS is a result of how customers are already using the Bing Maps control: “Some 70 percent of our customers use it for BI, including for asset tracking,” says Ricky Brundritt, Senior Program Manager for Bing Maps.

But the big surprise for Microsoft was that 37 percent of usage is on mobile devices, including 22 percent on iOS and 14 percent on Android. “The iOS and Android usage of the web control was higher than we expected, telling us that it’s used in cross-platform apps. That helped define what Bing Maps V8 was going to be,” continues Brundritt. Mobile usage inspired the new Lite mode: “You lose some of the nice new features, but there’s less processing required so it helps a high performance app run on low-end devices.”

There’s on-going development for large and high resolution screens too. As Brundritt points out, “When the previous version came out, most maps were no bigger than 600 by 400 pixels, but now we need to generate full-screen maps on 4K screens. That’s 40 times more data in the maps, so we had to speed things up, using different tiles for high resolution devices. Going to HTML5 really helped with that.”

Space Needle in Bing Maps Streetside view

The Bing Maps V8 control shows off its 360-degree street-level imagery.

New vector labels avoid text becoming invisibly small when the resolution increases. The vector label now sits above the map and above some of your data which prevents weather radar or a route map from obscuring labels on the map. Brundritt explains, “If you drew a route on a road then you couldn’t read the name of the road, but now the label shows up above the route.” The control also moves labels so they don’t obscure pushpins.

New features, such as being able to see different boundaries based on which region you set, or the many new geometry calculations available for selecting and drawing complex shapes, are based on what customers have been asking for. “We’ve talked with a lot of our customers and we’ve looked back over some five years of feedback from emails, forum posts and bug reports to figure out what kinds of apps our customers want to create, as well as where there are issues and how we should address them.”

The only significant feature that has been removed is venue maps. “It was a very hard call to make,” says Brundritt, “But no matter how many customers I talk to, very few used it. What enterprises are looking for are private venues; if you’re in the oil and gas industry, for example, you want to keep the internal layout of your refineries private.” That said, if there’s customer demand, then venue maps could return.

Bing Spatial Data Services (SDS) lets you pull in your own data to overlay on maps, and you can also add data from Microsoft like post codes, neighbourhoods, and city and county boundaries. However connecting such data to this new version now takes only 5 or 6 lines of code, rather than 50 or 60. Furthermore, you can upload a data set and have it exposed as a spatial REST service. “Say you want to find locations along a route or find locations that intersect a polygon. SDS makes it easy and turns the results into Bing Maps shapes for you so that you no longer have to do the parsing.”

You’ll see the same kind of coding reduction across the board. Simple tasks like loading maps and colouring polygons take far less code, as do complex operations like adding a polygon that contains a hole (for example Lesotho is a landlocked country that needs to be cut out of a polygon defining the border of South Africa). It used to take 170 lines of code to display the boundary of multiple postcodes; now it can be done with as little as 5 lines of code: “It’s much simpler and clearer code to write,” promises Brundritt.

SDS is now one of the optional modules that are only loaded when you need them, so reducing the size of the control. If you need spatial maths for custom visualisations then you can call it as a module instead of sending calculations to something like SQL Server, but it’s not loaded if you don’t use it. Another optional module is Autosuggest which dynamically suggests place names and addresses as you type a search, and can now be used with or without the map. You can also limit the results it produces so that it will only suggest cities and areas for weather forecasts, or postcodes for addresses.

Interactive SDK for Bing Maps V8 screenshot

The Interactive SDK for Bing Maps V8 lets you try out and customise code samples right in the browser.

Pushpin clustering stops maps looking cluttered when you zoom out by grouping several pushpins into one, annotated with a number. As Brundritt says, “It cleans up the map and makes it much slicker and easier to use, and there’s also a performance benefit from not having to load as much data.” But again, it’s an optional feature.

Heat maps give you a rich visualisation with minimal code, but not every app needs them so they’re another optional module, as are the tools for drawing an area on a map and searching inside it. These replace open source modules that were often used with the previous version and could cause delays in development for some customers who had to get legal approval before using them.

Another module lets you import and export GeoJSON data. “It’s one of the most common file formats; it’s used more heavily than KML today, so it made sense to make it easy to use.”

Other features that simplify development include the generation of test data for things like pushpins and polygons using a single line of code, or the ability to compress spatial data and encode it as a string to reduce bandwidth.

Cleaning up the programming model goes as far as the URL for the map control. Twenty years of mapping have left Microsoft with some legacy options that didn’t make sense anymore, so rather than using the now-mysterious dev.virtualearth.net/mapcontrol/mapcontrol.ashx you get the new version from bing.com/api/maps/mapcontrol. As Brundritt points out, the emphasis on backwards compatibility makes it easier to migrate, which now might involve as little as changing the URL used for the control.

It could also be cheaper to use because all the modules that connect to Bing Map services automatically use a session key from the map which means that the only billable transaction is for the initial loading of the map. This is an optimisation that was available for version 7 but required developers to implement themselves and was often overlooked.

 

Experiment and improve

The Bing Maps V8 control is in preview at the moment: “We’ll remove the preview label in the next few months,” says Brundritt, “but you can test it with live traffic now.” However the new branching model means that you will be able to choose between frozen, release and experimental features.
The frozen branch is for rarely-updated, mission-critical apps. “An experimental feature might not show up in the frozen version for a year, but if it’s a high security app being used in a 911 call centre you don’t care about new features as much as you care about not having any updates for a year, because that means less chance of a braking change occurring.”

During the preview, everything is experimental, including the new features planned for V8 that aren’t in the initial preview such as 360-degree street-side imagery, localisation into more languages and new map styles. The blue and white style of maps is designed to be easily read by the colour blind, but if you’re building visualisation apps you may prefer the dark and greyscale styles so your data stands out more. Custom image filters will be available soon which use the HTML5 canvas.

There will also be an easy way to export a map as an image: “Say that I want to include my map, rendered with my business data the way I want, and share it with my team. You used to have to manually take a screenshot and crop it, but now you can easily get an image and email or print it.” A new API for embedding maps without writing code will simplify integration with systems like SharePoint.

More geometry calculations are coming, including sophisticated options like Voroni diagrams: “If you want to create a buffer so you can search along a route – something you can do by default with Spatial Data Services – the process is optimised for a mile away from the road. If you want a smaller or bigger zone, you can take the route line and create a buffer to set the distance.” There will also be validation tools to help you work with data and shapes.

Once the control is released, new features will arrive in the experimental branch first so that developers can try them out and provide feedback. “They will be able to play with it, and if it doesn’t function the way they expect, they can let us know and we can modify it,” promises Brundritt.

Find Out More

MSDN documentation is at msdn.microsoft.com/en-us/library/mt712542.aspx and the interactive SDK at bing.com/api/maps/mapcontrol/isdk. You can find the Bing Maps website itself at www.microsoft.com/maps/v8control.aspx. For more information on mapping solutions see the Grey Matter website at www.greymatter.com/bingmaps. You can also call us on 01364 655133 or email mapping@greymatter.com.

Adobe Creative Cloud for Teams ad
HERE Maps ad