The Bing Maps WPF Control

Since rejoining the Bing Maps team, I’ve been heads down focusing on the developer experience for Bing Maps. As a result, we’re releasing the Bing Maps WPF Control Beta on the Microsoft Download Center. What is WPF? The Windows Presentation Foundation (WPF) provides developers with a unified programming model for building rich Windows smart client user experiences that incorporate UI, media, and documents.

The WPF Control has everything you’d expect from a Bing Maps control including the ability to present information via a WPF native control such as:

· Map Styles: Road, Aerial and Hybrid

· The ability to place shapes on the map via lat/lon – pins, polylines and polygons

· Navigating the map with pan and zoom keyboard controls

 

We’ve also opened up a lot of the abilities within the control to empower the developer to take control of the user experience. So, you’ll notice there is no default navigation, no default pushpins and none roll overs – this is truly a blank (er, map-based) canvas – we want to see you do some killer things with.

Perhaps the most notable facet to this WPF control is support for Microsoft Surface. That’s right. The Bing Maps WPF Control Beta is touch-enabled with support for Surface v 2’s Pixel Sense technology. So, for those of you using WPF in your Surface applications you’ll have native support for touch features.

We worked closely with the Surface team and have had a constant need to support our WPF developer community with mapping. In the past, we’ve pushed to have WPF developers use the Bing Maps Silverlight Control (or our Bing Maps AJAX Control v7) in a web control, but it’s just not the same as having managed code libraries to work with.

The WPF control supports full rotation and inertia with options to turn both off. Plus, infinite scroll maps, touch to lat/lon to pixel conversions (think touch to add a pushpin) and the ability to plug into the Bing Maps REST API for geocoding and routing or the Bing API for search.

We hope you enjoy the control. It’s a beta, so we’re looking for some feedback on what you think, what works and what doesn’t. All questions/comments/feedback can be directed to the MSDN Forums. We hope to see some awesome applications built in WPF and Surface applications with our Bing Maps control.

Bing Maps: SQL Server Denali CTP3

At the beginning of the week, there was a new version of the Bing Maps AJAX API rolled out (version 7.0.20110630165515.17). There’s a list of changes at http://msdn.microsoft.com/en-us/library/gg675211.aspx but, to summarise them here:

  • Directions and Traffic information (both features that were included in the core 6.x control) have been added back into v7 using the new optional module functionality.
  • New venue maps mode allows you to see layouts in the inside of shopping malls etc.(Haven’t seen much use for this yet – don’t know if it really exists outside the US)
  • You can now disable birdseye mode – very useful since it prevents you accidentally breaching the Terms of Use if not licensed to use it!
  • Polygons and polylines have a new dashstyle property, which means you can style vector shapes so that, for example, electricity lines and railways show as dashed lines (as in an Ordnance Survey map).

I’m particularly pleased about the last two features, since these are both things that I’ve suggested about on the MSDN forums… whether it’s coincidence or not, I’m glad they’ve now been implemented.

SQL Server Denali CTP3

A download link to the latest preview version of SQL Server was announced on Twitter, and a rapid rush of tweets followed as people clammered to see what new features were included.

image

I’m only interested in summarising changes for the spatial toolset, which as far as I’ve found out so far, are as follows:

Firstly, the Spatial Results tab is back! Introduced in SQL Server 2008, broken in CTP1, and back again, it’s everyone’s favourite quick way of visualising geometry or geography data. The 5,000 object limit still seems to be in place:

image

My next test was to see whether it could plot the new curved geometry types. Initial results were disappointing, when selecting a CircularString resulted in nothing but a white screen, while a LineString drawn between the same set of points was displayed as expected:

image

This same problem occurred across all curved geometry types – to display a curved geometry in the spatial results tab, it seems you have to linearise it first – for example, using STCurveToLine(), or creating a linear buffer around it using STBuffer() as shown here:

image

(Note that, although these features look curved, they’re really just a many-sided LineString and Polygon, respectively). Hopefully displaying true curved features will make it into the next release.

As for new functionality, there’s a new extended method, IsValidDetailed() – which tells you not only whether a geometry is valid (which is what the OGC STIsValid() method does), but why it’s invalid. Here’s an example script to test it:

DECLARE @g geometry = 'LINESTRING(0 0, 5 10, 8 2)';
DECLARE @h geometry = 'LINESTRING(0 0, 10 0, 5 0)';
DECLARE @i geometry = 'POLYGON((0 0, 2 0, 2 2, 0 2, 0 0), (1 0, 3 0, 3 1, 1 1, 1 0))';
SELECT
  @g.STIsValid() AS STIsValid, @g.IsValidDetailed() AS IsValidDetailed
UNION ALL SELECT
  @h.STIsValid(), @h.IsValidDetailed()
UNION ALL SELECT
  @h.STIsValid(), @i.IsValidDetailed()

And this is the output – which is much more useful when it comes to fixing invalid data than a simple Boolean obtained from STIsValid():

image

As with some of the updates to the Bing Maps control, I was particularly pleased to see this feature get included since it was something I’d raised in the MSDN forum – Microsoft are certainly scoring lots of points with customer responsiveness with me this week!

The only other functional addition I could see was the AsBinaryZM() method, which retrieves the Well-Known Binary of a geometry, complete with Z values. Previously, the only way to retrieve (or input) geometries containing Z and M values was via Well-Known Text, since the WKB representation stored 2d coordinates only.

The new method works pretty much as you’d expect, and the resulting serialised value also demonstrates some of the flags indicating this geometry has Z values:

DECLARE @g geography = 'POINT(1.6 52.5 100)';
SELECT
  @g.STAsBinary(),
  @g.AsBinaryZM()

Microsoft’s Bing Maps for Android- pleasant surprise for me!

Microsoft’s Bing for Android may not technically be the first Microsoft-made app for Android phones (that honor belongs to the rather obscure Microsoft Tag Reader,) but the Bing is its highest-profile app.

Bing for Android closely resembles Bing for iPhone, with an image of the day marking the backdrop, and a pop-up menu to search by images, movies, maps, news, or what’s nearby. There’s also an option for directions. A search field sits at the top, next to a voice search button. Bing for Android hides your history, settings, and favorites in the phone’s hard-coded Menu button.

The Android version of Bing also integrates maps, and the touchable hot spots hidden in the day’s image that reveal additional information about the photo du jour. Swiping backward loads previous images.

However, Bing for Android lacks two significant features found in the iPhone version-options for scanning an item’s bar code with your camera, and connecting to your Twitter and Facebook feeds.

We’re fans of the Bing app on all platforms we’ve tested, and while we’d like to see this Android version gain parity with the iPhone version, usabilitywise, it’s no exception. We’d also like to see the Maps portion add directions for public transit–a la Google Maps-to complement its driving and walking directions.