Jerry Nixon on Windows: Adding Location, Geocoding, and Bing Maps to Windows 8 Apps

Jerry Nixon on Windows

Thursday, August 9, 2012

Adding Location, Geocoding, and Bing Maps to Windows 8 Apps

imageDid you know that the Windows 8 Location service does not require a GPS? It’s totally true. So many applications have to use location and so many applications should. With Windows 8, sensors and location isn’t a “what if” it’s a standard service that “just works”.
MSDN: Computers today are more mobile than ever. From small laptops to Tablet PCs, many computers can go wherever the user wants to go. Programs that take advantage of the computer's mobility can add significant value to people's lives. For example, a program that can find nearby restaurants and provide driving directions would seem to be a natural fit for a portable computer. But while the technology to determine the user's current location is common and affordable, building solutions on this technology can be a daunting task.
Built on the Sensor API, the Location API provides an easy way to retrieve data about geographic location while protecting user privacy. The Location API provides its functionality through a set of COM interfaces. These interfaces can be used in scripting languages, such as JScript, or by COM programmers through the C++ programming language.
Scripting support gives easy access to location data for projects that run in the Local Computer zone, such as gadgets. The Microsoft Windows Software Development Kit (SDK) for Windows 7 and .NET Framework 4.0 includes header files, documentation (including scripting reference documentation), samples, and tools to help show Web and software developers how to use location information in their programs.
Windows 7 includes a control panel that lets computer administrators enable or disable sensors system-wide or for each user. Because some sensors can expose sensitive data, this user interface gives administrators control over whether programs have access to each sensor for each user. Users can also view sensor properties and change the sensor description that appears in the user interface.

The Bing Maps API

Using the Bing Maps service we can access geocoding information as well as imagery. When developers go to they can get a free, developer key to access all this.
BING: The Bing Maps Account Center allows you to create keys to use the Bing Maps AJAX Control, Bing Maps Silverlight Control, Bing Maps SOAP Services, Bing Maps REST Services and Bing Spatial Data Services. It also allows you to upload Bing map apps (beta).

Here we go

Get my Map Helper here.

Here’s the code I demonstrated:


Get the real code here.

In the code above, I step through all three scenarios. Accessing the Location API to get my Latitude and Longitude. Accessing the Bing service to translate my Latitude and Longitude into the address string. And also leveraging the Bing API to access static map imagery.

Best of luck!