Windows Phone 7 Bing Maps Control

cmpendleton 1,688 views 24 slides Oct 18, 2010
Slide 1
Slide 1 of 24
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24

About This Presentation

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


Slide Content

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

Agenda Bing Maps Content APIs Infrastructure Windows Phone 7 Control Classes Coding Q&A

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

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 .

Content: Maps New Map Style

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

Content: Routing Shortest, fastest, walking and traffic-based Offers route geometry for spatial queries

Content: Search Yellow Page listings available via map API Nearly 20 million listings available

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

Infrastructure Content (tiles and controls) worldwide deployment across Azure Content Delivery Network Services deployed across Azure Dynamic Compute Network

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)

New Classes Class Features MapAutomationPeer Handlers for interacting with the device - Double Tap , Drag, Flick, Scale, Zoom MapDragEventsArgs Measures screen distance - DragDelta MapFlickEventArgs Measure s 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

Maps.Platform Classes Class Features Location Defines lat / lon Rectangle Northeast and Southwest map corners ShapeBase Serialization

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); } } }

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 (); } } … }

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>

Hello World  1. Load Map

Switch Map Modes Loads Map Control Specifies Center Point Specifies Map Mode Button switches map style

Locate Me Using GPS Load Map Access GPS Re-center and Zoom Map

Using Shapes Load Map Re-center and Zoom Map Draw Polygon

Which API is Right for You? Surface Mobile PC Browser AJAX Map Control Silverlight Control SOAP Services REST Services Map App SDK Bing Maps Platform Customer Servers End User www.bing.com/maps MapPoint Web Services + Data Source

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!

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

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