MapPoint Web Service

Download Report

Transcript MapPoint Web Service

Developing Mobile Solutions
with MapPoint Web Service
Rik Temmink
Agenda
MapPointMobile demo
MapPoint System overview
Building mobile MapPoint applications
Efficient: caching and pre-fetching maps
Fast: optimizing and avoiding web calls
Engaging: dynamic map Interaction
Best practices
Future developments
MapPointMobile
Mapping at Microsoft
• Vicinity acquisition
• Launched ‘04 CD
titles
• Introduced MapPoint
Web Service
• Launched MSN M&D
2003
2001
• MapPoint BU
established
• First consumer
products
Maps & Directions
1999
1995
• Added business
mapping
• Added mobile products
2005
• Released GPS bundle
• Introduced MapPoint
Location Server
• Pocket Streets for
SmartPhone
Integration Advantage
Streets & Trips
AutoRoute
MapPoint CDs
MapPoint
Web Service
Maps &
Directions
MapPoint
Location Server
Pocket Streets
For Pocket PC & Smartphone
MapPoint Scenarios
Consumer
Business
Store Locator
Retail business
location finder
Travel Portal
Mapping of POIs:
hotels, restaurants,
attractions, etc.
Location by Phone
Experience via:
1-800-545-0118
Yellow Pages
Experience at:
http://maps.msn.com
Mobile
Devices
Find the nearest
Starbucks, post
office, or even your
buddy!
Call Centre
Quickly route
customers to
the next store
Field Service
Management
Reschedule and
reroute service
technicians to new
customers
Fleet / Asset Tracking
Integration of real time
tracking, routing and
mapping into fleet
management
MapPoint Web Service
Devices
Applications
MapPoint Web Service
APIs
Store Locator
SOAP/HTTP
Requests
HTTP
SOAP
Asset Mgt
Voice
SMS
WAP
Maps, POI,
Traffic, etc
• Get maps
• Find places/addrs
• Driving directions
• Proximity searches
• Reverse geocoding
• Batch geocoding
• Address parsing
• Address clean-up
Extranet
.NET Framework
Visual Studio .NET
Linux*, Perl*, Java*
Cartographic
Points of Interest
(Yellow Pages)
• Manage billing info
• View xaction reports
• Change passwords
• Upload POI/icons
Yellow Pages
Microsoft
Mobile apps
Data
MapPoint
Location Server
Construction
Database
• Config info
• Account info
• Customer POI
• Custom icons
Real-Time Traffic
MapPoint Location Server
Secure
channel
MapPoint Location Server
WWAN
Provider
WLAN
Provider
Other
Provider
Provider Manager
Features / APIs
Database
• User profile
• Privacy
• Config
• Logging
Mobile client apps
Mobile Operator Network
MapPoint Web Service
• User profile mgt
• Locate users
• Privacy mgt
• Web service proxy
Admin UI
Mobile Operator’s
Location Service
Client applications
Customer Network
Microsoft Network
Agenda
MapPointMobile demo
MapPoint System overview
Building mobile MapPoint applications
Efficient: caching and pre-fetching maps
Fast: optimizing and avoiding web calls
Engaging: dynamic map Interaction
Best practices
Find Service
Find addresses and geographic entities
Find POI spatially or along routes
Parse addresses
FindAddressSpecification myFAS =
new FindAddressSpecification();
myFAS.InputAddress = my Address object
myFAS.DataSourceName = “MapPoint.NA”;
FindResults results =
FindService.FindAddress(myFAS);
Route Service
Calculates routes and itinerary
Shortest or quickest route options
Use CalculateSimpleRoute for LatLong
point based routes
Route myRoute = RouteService.CalculateSimpleRoute(
LatLong[], "MapPoint.NA",
SegmentPreference.Quickest);
Segment tripSegment = myRoute.Itinerary.Segments[0];
foreach (Direction step tripSegment.Directions)
Console.WriteLine(step.Instruction);
Render Service
Render maps to show icons, routes
30 map styles available
4 designed specifically for devices
MapSpecification mapSpec = new MapSpecification();
mapSpec.DataSourceName = “MapPoint.NA”;
mapSpec.Options = desired size and style
mapSpec.Views = my MapViewRepresentation object
MapImage[ ] maps = RenderService.GetMap(mapSpec);
Image mapImage =
new Bitmap(MemoryStream(maps[0].MimeData.Bits));
MapPointMobile Design
MapPointMobile.Common.dll
Custom UI control: MapZoomBar
Custom UI control: MapControl
Application state
Map cache
Web Service wrapper classes
Persisted settings
Geographic point conversion
PocketPC and Smartphone apps
Common Classes: Pushpin
public class Pushpin
{
PushpinType Type; // POI, Address, Place, etc…
string Name;
LatLong Location;
string IconName;
Address PrimaryAddress;
string PrimaryPhoneNumber;
MapViewRepresentations BestMapView;
…
}
Common Classes: MapState
public class MapState
{
public Image MapImage;
public HotArea[] HotAreas;
public double ZoomLevel;
public LatLong CenterPoint;
…
}
Wraps image and other data returned
from RenderService
Used throughout the app, cached,
persisted, etc…
Caching & Pre-Fetching Maps
efficient [i-físh-’nt]
1. being effective without
wasting time or effort or
expense
2. making smarter map
applications on Windows
Mobile by reducing
download times
Caching Maps
Useful when users return frequently to
the same maps
Increases application performance
Reduces data bandwidth use
Maintain cache order (e.g. MRU, FIFO)
Tip - use a Hashtable for map cache
Key - generated from MapSpecification
Value - save a “MapState” object
Cache Code Sample
public MapState GetMap(MapSpecification mapSpec)
{
int key = mapSpec.GetHashCode();
if (mapCache.Contains(key)) {
myMapState = cache.Items[key];
}
else {
myMapState = RenderService.GetMap(mapSpec);
cache.Add(key, myMapState);
}
return myMapState;
}
Pre-Fetching Maps
Useful when a user is stepping through
driving directions or panning a map
Increases perceived performance
Leads to more cache hits
But… application may download more
data than is necessary
Optimizing and Reducing
Web Service Calls
fast & flexible [fast & fléksəb’l]
1. acting or moving rapidly,
able to bend without
breaking
2. able to handle complex
geographic computations
on the device
Local XY To LatLong
Determine the coordinate of a point
locally
Reduces calls to MapPoint WS
Increases application performance
Examples…
Adding a pushpin to a point on the map
Handling when points move off screen
Local Pushpin Rendering
More flexibility with icons and graphics
Increases application performance
Reduces render calls to MapPoint
More cache hits
Notes…
Pushpin icons can clobber labels
Implement hit detect using hot areas
Optimizing Find Calls
1/3
Use ResultMask to filter unnecessary
returned information
Available on Find, FindAddress and
FindNearby calls
Return or omit Address, Map View,
LatLong location, entity ID
FindSpecification findSpec =
new FindSpecification();
findSpec.Options.ResultMask =
FindResultMask.AddressFlag;
FindService.Find(findSpec);
Optimizing Find Calls
2/3
Use FindRange to limit the number of
entities returned
Available on Find, FindAddress and
FindNearby calls
Set starting index and number to
return
FindSpecification findSpec =
new FindSpecification();
findSpec.Options.FindRange = new FindRange();
findSpec.Options.FindRange.StartIndex = 0;
findSpec.Options.FindRange.Count = 10;
FindService.Find(findSpec);
Optimizing Find Calls
3/3
Specify EntityTypeName to narrow the
scope of your search
Available on Find and FindNearby only
Example…
Find “Washington, USA” has 70+ results
Only 1 with filter = “AdminDivision1”
FindSpecification findSpec =
new FindSpecification();
findSpec.InputPlace = “Washington, USA”;
findSpec.Filter = new FindFilter();
findSpec.Filter.EntityTypeName = “AdminDivision1“;
FindService.Find(findSpec);
Dynamic Map Interaction
engaging [en gáyjing]
1. charming or pleasing in a
way that attracts and
holds the attention
2. building the coolest
mapping applications on
the coolest mobile
platform
Drag Panning
Drag Panning
Creates a more engaging experience
Reduces round trips to MapPoint
Useful with stylus and d-pad
Don’t forget…
Labels may run off the sides
Not ideal for route overview maps
Maps will be 9x size of the map control
Static 240x240 map: 450 bytes
Drag pan enabled: 4000 bytes
MapControl Overview
Custom control to handle map render
and user interaction
Exposes 2 simple methods:
mapControl.RenderPin(pins, centerPin)
mapControl.RenderRoute(pins, route,
step)
4 modes: Pan, Zoom, Route, CrossHair
Fires events for location, mode and
crosshair position changes
Handles relevant d-pad / stylus / key
events, passes others to parent form
Handling a Large Map
Point: mapOffset
In OnMouseDown event override:
mousePt = new Point(
mapOffset.X + e.X, mapOffset.Y + e.Y);
foreach (HotArea target in mapState.HotAreas) {
if (target.Area.Contains(mousePt.X, mousePt.Y))
SelectedPushpinChanged(this, args);
}
Zoom Control
Custom ZoomBar control
Use discreet steps to promote cache hits
Snap “BestMapView” to nearest step
Use a timer to allow multiple level
changes with one render call
Zooming in MWS
Use web service’s ViewByScale view
Scale is the denominator of the ratio:
screen unit
earth unit
Example: Scale = 502,000,000 earth
rendered as 1 inch (at 96dpi)
Zooming: Zoom Range
Avoid a linear zoom levels to create
more useful range
1,000mi
250ft
1
2
3
4
5
6
7
8
9
10
mwsScale = 10 * (zoomLevel
4.3)
+ 1000
Tips and Tricks Summary
Use cancellable asynchronous web
methods
Find calls may return multiple results
Cache and pre-fetch maps
Store cache as a Hashtable
Use local calculations when possible
and appropriate
Avoid a linear zoom range
MapPoint Today
User Experiences:
Streets & Trips #1 in desktop consumer mapping
MSN Maps & Directions has 6 million UU and growing
Windows Mobile navigation and mapping
Mapping Platform:
MapPoint Web Service does 25 million transactions a day
MapPoint Location Server enables real-time location
Location technology provider to other groups
Virtual Earth
Virtual Earth is a platform, experiences and a
community for capturing, connecting, sharing
and visualizing of information based of location.
Virtual Earth will revolutionize online mapping
experiences with rich navigation tools, aerial and
satellite images, perspective land views, real-time user
location, traffic conditions, speech interfaces, new and
unique map styles, synchronization and much more.
Virtual Earth
A place where everything about the real world is available in an online Virtual World
Virtual Earth
Search for Businesses
Business Details
Detailed Yellow Pages
45 Degree Angle View
Virtual Earth
Traditional
Virtual
Earth
Autolocate
A software component that enables location
awareness for Microsoft applications.
It allows these applications to get information about the
user’s location through visible WiFi access points and
a database of these access points’ location.
Autolocate
A new component in the value proposition for wireless computing
Autolocate
WiFi – Seattle, WA
Next Steps
Sign-up for a Developer Account
http://www.microsoft.com/mappoint
Download Sample Code
http://msdn.microsoft.com/mappoint
Do cool things 
Resources
MapPoint SDK & Training
http://msdn.microsoft.com/mappoint
Sample Applications
http://demo.mappoint.net
Newsgroups
microsoft.public.mappoint.webservice
.NET Compact Framework
http://msdn.microsoft.com
/smartclient/understanding/netcf
Stephen Turner’s Blog
http://blogs.msdn.com/digilocity
© 2005 Microsoft Corporation. All rights reserved.
This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.