Bing Maps for Windows Store Apps

26
Bing Maps for Windows Store Apps Chris Pendleton Sr. Program Manager, Lead 3-133

description

Bing Maps for Windows Store Apps. Chris Pendleton Sr. Program Manager, Lead 3-133. Agenda. Bing Maps on Windows 8 Bing Maps for JavaScript Bing Maps for Managed & Native Code Application Protocol Handling Licensing Q&A. Bing Maps on Windows 8. Demo: Bing Maps Application. - PowerPoint PPT Presentation

Transcript of Bing Maps for Windows Store Apps

Page 1: Bing Maps  for  Windows Store Apps

Bing Maps for Windows Store AppsChris PendletonSr. Program Manager, Lead3-133

Page 2: Bing Maps  for  Windows Store Apps

Bing Maps on Windows 8Bing Maps for JavaScriptBing Maps for Managed & Native CodeApplication Protocol HandlingLicensingQ&A

Agenda

Page 3: Bing Maps  for  Windows Store Apps

Bing Maps on Windows 8

Page 4: Bing Maps  for  Windows Store Apps

Demo: Bing Maps Application

Page 5: Bing Maps  for  Windows Store Apps

Bing Maps for JavaScript

Page 6: Bing Maps  for  Windows Store Apps

Bing Maps for JavaScript• Supported by Bing Maps AJAX Map Control• Modular Approach• Maps, Pins, Lines, Polygons• Modules: Search, Venue Maps, Advanced

Shapes, etc.• Integration with Bing Maps Web Services• Geocoding• Routing• Search• Spatial Data Services

Page 7: Bing Maps  for  Windows Store Apps

Demo: Hello World

Page 8: Bing Maps  for  Windows Store Apps

Code Walkthrough<!-- Bing Map Control references --> <script type="text/javascript" src="ms-appx:///Bing.Maps.JavaScript//js/veapicore.js"></script>

Microsoft.Maps.loadModule('Microsoft.Maps.Map', { callback: initMap, culture: en-us, homeRegion: US});

function initMap()

{ var map; var mapOptions = { credentials: "INSERT_YOUR_BING_MAPS_KEY" };

map = new Microsoft.Maps.Map(document.getElementById("mapDiv"), mapOptions); }

Page 9: Bing Maps  for  Windows Store Apps

Demo: Bing Maps & Twitter

Page 10: Bing Maps  for  Windows Store Apps

Code Walkthroughfunction GetMap() { // Initialize the map map = new Microsoft.Maps.Map(document.getElementById("myMap"), {credentials:"Bing Maps Key"}); // Retrieve the location of the map center var center = map.getCenter(); // Add a pin to the center of the map var pin = new Microsoft.Maps.Pushpin(center, {draggable: true}); // Add a handler to the pushpin drag Microsoft.Maps.Events.addHandler(pin, 'mouseup', DisplayLoc); map.entities.push(pin); } • DO not use EVAL – Apps will be rejected. Use Winjs.XHR (XML HTTP

Request) - for calling web services

Page 11: Bing Maps  for  Windows Store Apps

Bing Maps for Managed & Native

Page 12: Bing Maps  for  Windows Store Apps

Bing Maps for Managed & Native• Supports Managed and Native Code• Methods – Maps, Pins, Lines, Polygons, Layers• Events – LandmarkTapped, MapStyleChanged,

etc.• Modules – Venue Maps• Integration with Bing Maps Web Services• Geocoding• Routing• Search• Spatial Data Service

Page 13: Bing Maps  for  Windows Store Apps

Demo: Hello World

Page 14: Bing Maps  for  Windows Store Apps

Code Walkthrough<Page x:Class="Application1.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:Application1" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:bm="using:Bing.Maps" mc:Ignorable="d">

<Grid Background="{StaticResource ApplicationPageBackgroundBrush}"> <bm:Map credentials="INSERT_YOUR_BING_MAPS_KEY" x:Name="myMap" MapType="Aerial" ZoomLevel="12"> <bm:Map.Center> <bm:Location Latitude="46.227480" Longitude="-122.192955" /> </bm:Map.Center> </bm:Map> </Grid>

</Page>

Page 15: Bing Maps  for  Windows Store Apps

Demo: Shapes

Page 16: Bing Maps  for  Windows Store Apps

Code WalkthroughMapShapeLayer shapeLayer = new MapShapeLayer(); MapPolygon polygon = new MapPolygon();

polygon.Locations = new LocationCollection() { new Location(44, -107), new Location(44, -110), new Location(46, -110), new Location(46, -107) }; polygon.FillColor = Windows.UI.Colors.Red; shapeLayer.Shapes.Add(polygon);

map.ShapeLayers.Add(shapeLayer);

Page 17: Bing Maps  for  Windows Store Apps

Application Protocol Handling

Page 18: Bing Maps  for  Windows Store Apps

Application Protocol Handling• Allows you to link from any app to the Bing

Maps App• Use BingMaps:• Set Centerpoint• Geocode a Location• Search the Map• Set map style and zoom level• Overlay traffic• Generate a route

Page 19: Bing Maps  for  Windows Store Apps

Code Walkthrough: Searchbingmaps:?q=coffee&where=Seattle

Page 20: Bing Maps  for  Windows Store Apps

Demo: Travel to Bing Maps

Page 22: Bing Maps  for  Windows Store Apps

Licensing

Page 23: Bing Maps  for  Windows Store Apps

LicensingBing Maps is Free for Windows 8As follows:• Allotment of up to 50,000 cumulative billable transactions as defined in

the SDKs, within any 24 hour period • Evaluation for Commercial, Non-Commercial or Government Use:

allotment of up to 10,000 cumulative billable transactions as defined in the SDKs, in any 30 day period. 

• SDS: Up to 5 batch geocoding or file uploads with of up to 50 records each, using the Bing Spatial Data Services API, within any 24 hour period.   

• Cannot be used in connection with Windows Store Apps Company Applications used by authenticated enterprise users (employees or agents of the enterprise) over a private network without a Bing Maps Agreement

Questions: [email protected]

Page 24: Bing Maps  for  Windows Store Apps

Resources• Bing Maps: Microsoft.com/Maps• Bing Maps Keys: BingMapsPortal.com• See – “Security in Windows Store apps” session• Bing Maps Terms of Use: http://

www.microsoft.com/maps/product/terms.html• Bing Maps Licensing: Microsoft.com/Maps• Bing Maps for Windows Store Apps SDK: http://

msdn.microsoft.com/en-us/library/hh846481.aspx • Bing Maps Application Protocol Handler: http://

msdn.microsoft.com/en-us/library/windows/apps/jj635237.aspx

• Contact: [email protected]

Page 26: Bing Maps  for  Windows Store Apps

© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.