The TomTom/BingMaps Starter Kit is a XAML/C# Windows Store application that demonstrates a mashup of BingMaps with the Traffic Cams API provided by TomTom. The application has been built to easily overlay and display locality-based information obtained from other APIs.
- Incorporates Bing Maps for Windows Store control and invokes a the Bing Maps Find a Location by Query REST API
- Invokes the TomTom Traffic Cameras API
- Demonstrates how to deserialize both XAML and JSON to C#
- Provides a baseline for a Windows Store App
- Windows 8
- Visual Studio 2012 Express for Windows 8 or higher
- Bing Maps SDK for Windows Store apps and license key
- Mashery ID to access TomTom Developer Portal and obtain API license key
- Download the Starter Kit Zip Portfolio
- Navigate to the APIMASH_TomTom_BingMaps__StarterKit directory and open the solution there
- In order to compile the application:
- From within Visual Studio, install the Bing Maps SDK for Windows Store Apps by going to Tools>Extensions and Updates... and searching for "Bing Maps SDK" in the Visual Studio Gallery (or download and install separately)
- In Visual Studio select Tools>Options>Package Manager>General and make sure Allow NuGet to download missing packages during build is checked
- If you get an error indicating the build type of "Any CPU" is not supported, change the build configuration of the solution to "x86" as shown in the image below
- Paste your Bing Maps API and TomTom Traffic Cam API keys into designated portion of the App.xaml file
This starter kit was built in a modular manner to make it easy to integrate just about any API that has elements exposing latitude and longitude. The Bing Maps implementation already includes necessary logic for showing point-of-interest pins, marking your current location as determined by GPS, and allowing a location search via a flyout accessible from the App Bar. The Search contract is also already implemented with a landing pages showing the results and a static map snippet for each location found.
The code includes "TODO" markers in the files to highlight what needs to be modified to accomodate a different geo-encoded API as well as optional steps that can be used to further customize the code. At a high level, you'll need to minimally do three things:
- Implement an API wrapper class (using the APIMASH_TomTom.cs implementation as a model)
- Modify LeftPanel.xaml and its code-behind to data bind to your API's view model (and optionally adapt the layout). Note that LeftPanel.xaml is the requisite size for Window 8 snapped view, so no special adaptation is needed.
- Modify the AboutFlyout, PrivacyFlyout, and SupportFlyout to reflect your application
Upon store submission, you will need to create separate packages for each of the target architectures (ARM, x86, and x64) due to the reliance of the Bing Maps control on a native C++ layer.
The sample code described herein is provided on an "as is" basis, without warranty of any kind, to the fullest extent permitted by law. Both Microsoft and I do not warrant or guarantee the individual success developers may have in implementing the sample code on their development platforms or in using their own Web server configurations.
Microsoft and I do not warrant, guarantee or make any representations regarding the use, results of use, accuracy, timeliness or completeness of any data or information relating to the sample code. Microsoft and I disclaim all warranties, express or implied, and in particular, disclaims all warranties of merchantability, fitness for a particular purpose, and warranties related to the code, or any service or software related thereto.
Microsoft and I shall not be liable for any direct, indirect or consequential damages or costs of any type arising out of any action taken by you or others related to the sample code.
1.0.1: added more detail to the Setup section and added Customization guidance
1.0.2: called out inclusion of Search contract
1.0.3: added screen shot of Configuration Manager
1.0.4: merged JSON class changes and MaxResults bugfix from boolship