Windows Phone 7 Bing Maps Control

24
Bing Maps for Windows Phone 7 Chris Pendleton (Ex) Bing Maps Technical Evangelist Microsoft Corporation @ChrisPendleton

description

I presented this deck to the Seattle Silverlight User's Group on Oct. 6, 2010. It convers the Bing Maps Control for Windows Phone 7

Transcript of Windows Phone 7 Bing Maps Control

Page 1: Windows Phone 7 Bing Maps Control

Bing Maps for Windows Phone 7Chris Pendleton(Ex) Bing Maps Technical EvangelistMicrosoft Corporation@ChrisPendleton

Page 2: Windows Phone 7 Bing Maps Control

Agenda

Bing Maps – Content– APIs– Infrastructure

Windows Phone 7 Control– Classes– Coding

Q&A

Page 3: Windows Phone 7 Bing Maps Control

Content: Geocoding

Over 85 million parcel centroids in US Parcel centroids in Japan and

Germany now live Parcels provide a high level of

accuracy Falls back to interpolation Bulk geocoding available No daily limits on geocoding

Page 4: Windows Phone 7 Bing Maps Control

Content: Maps

Road data mostly from NAVTEQ. Highway or Capital coverage for

every country in the world; street level data for 37 countries

Full Bing list of coverage.

Page 5: Windows Phone 7 Bing Maps Control

Content: Maps

New Map Style

Page 6: Windows Phone 7 Bing Maps Control

Content: Aerial

Uses a combination of satellite and aerial photos up to 12 inches per pixel.

Flying Global Ortho Project to provide 12 inch resolution photos for all 48 lower states and W. Europe

Refresh rate every 2-3 years Partner: Digital Globe

Page 7: Windows Phone 7 Bing Maps Control

Content: Routing

Shortest, fastest, walking and traffic-based

Offers route geometry for spatial queries

Page 8: Windows Phone 7 Bing Maps Control

Content: Search

Yellow Page listings available via map API

Nearly 20 million listings available

Page 9: Windows Phone 7 Bing Maps Control

Developer APIs

AJAX API Silverlight Control SOAP Service ReST Service Bing Map App API Spatial Data API

Page 10: Windows Phone 7 Bing Maps Control

Infrastructure

Content (tiles and controls) worldwide deployment across Azure Content Delivery Network

Services deployed across Azure Dynamic Compute Network

Page 11: Windows Phone 7 Bing Maps Control

Windows Phone 7 Bing Maps Control

Native to WP7 SDK (Woohoo!) Based on Bing Maps Silverlight

Control Some features removed (for perf) Some features added (for device) Some class changes (for conflict)

Page 12: Windows Phone 7 Bing Maps Control

New Classes

Class Features

MapAutomationPeer Handlers for interacting with the device - DoubleTap, Drag, Flick, Scale, Zoom

MapDragEventsArgs Measures screen distance - DragDelta

MapFlickEventArgs Measures screen distance - Velocity

MapInputEventArgs Map events – Handled, ViewportPoint

MapZoomEventArgs Touch zoom events – ZoomDelta

MatrixHelper Device movements – Rotate, Rotate at, Translate

Overlay Controls atop the map – FireTemplateApplied, TemplateApplied

ZoomBar Controls the zoom bar – OnApplyTemplate, OnZoomMap, ZoomMap

Page 13: Windows Phone 7 Bing Maps Control

Maps.Platform Classes

Class Features

Location Defines lat/lon

Rectangle Northeast and Southwest map corners

ShapeBase Serialization

Page 14: Windows Phone 7 Bing Maps Control

Setting Centerpoint (C#)

using Microsoft.Phone.Controls.Maps;using System.Device.Location;

namespace WindowsPhoneApplication1{ public partial class MainPage : PhoneApplicationPage { // Constructor public MainPage() { InitializeComponent(); map1.SetView(new GeoCoordinate(42.123, -120.123), 17); }}}

Page 15: Windows Phone 7 Bing Maps Control

Change Map Styles (C#)

using Microsoft.Phone.Controls.Maps;using System.Device.Location;

namespace WindowsPhoneApplication1{… private void button1_Click(object sender, RoutedEventArgs e) {

if (map1.Mode is RoadMode) { map1.Mode = new AerialMode(true); } else { map1.Mode = new RoadMode(); } }…}

Page 16: Windows Phone 7 Bing Maps Control

Set Map Properties (XAML)

… xmlns:my="clr-namespace:Microsoft.Phone.Controls.Maps;assembly=Microsoft.Phone.Controls.Maps">

<!--LayoutRoot is the root grid where all page content is placed--> <Grid x:Name="LayoutRoot" Background="Transparent"> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="*"/> </Grid.RowDefinitions>

<!--TitlePanel contains the name of the application and page title--> <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28"> <TextBlock x:Name="ApplicationTitle" Text="CP's Mapplication" Style="{StaticResource PhoneTextNormalStyle}"/> <TextBlock x:Name="PageTitle" Text="My Maps!" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/> </StackPanel>

<!--ContentPanel - place additional content here-->

<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">

<my:Map Height="503" HorizontalAlignment="Left" Margin="9,6,0,0" Name="map1" VerticalAlignment="Top" Width="447" ZoomBarVisibility="Visible" Mode="Aerial" CredentialsProvider=“[BINGMAPSKEY]"/> <Button Content="Switch Map Styles" Height="72" HorizontalAlignment="Left" Margin="69,534,0,0" Name="button1" VerticalAlignment="Top" Width="337" Click="button1_Click" /> </Grid> </Grid>

Page 17: Windows Phone 7 Bing Maps Control

Hello World

1. Load Map

Page 18: Windows Phone 7 Bing Maps Control

Switch Map Modes

1. Loads Map Control2. Specifies Center Point3. Specifies Map Mode4. Button switches map

style

Page 19: Windows Phone 7 Bing Maps Control

Locate Me Using GPS

1. Load Map2. Access GPS3. Re-center and Zoom

Map

Page 20: Windows Phone 7 Bing Maps Control

Using Shapes

1. Load Map2. Re-center and Zoom

Map3. Draw Polygon

Page 21: Windows Phone 7 Bing Maps Control

Which API is Right for You?

Surface

Mobile

PC

Browser

AJAX Map Control

Silverlight Control

SOAP Services

REST Services

Map App SDK

Bing

Map

s Pl

atfor

m

Customer Servers

End User

www.bing.com/maps

MapPoint Web Services

+ Data Source

Page 22: Windows Phone 7 Bing Maps Control

Next Steps

Download WP7 SDK Get a Bing Maps Key at

BingMapsPortal.com Reference the WP7 Docs Reference the Bing Maps Silverlight

Control docs Build a killer app!

Page 23: Windows Phone 7 Bing Maps Control

Q&A

Yes, it’s free for native mobile apps (all platforms)

Yes, it’s free on the web…for the most of you

Yes, it’s free for education and NFP It’s all free unless…you exceed usage

thresholds on the web

Page 24: Windows Phone 7 Bing Maps Control

© 2010 Microsoft Corporation. All rights reserved.This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.