Upload
caitlin-madden
View
216
Download
0
Tags:
Embed Size (px)
Citation preview
touchdevelop api
api: location &mapsshow geo locations
Disclaimer: This document is provided “as-is”. Information and views expressed in this document, including URL and other Internet Web site references, may change without notice. You bear the risk of using it. This document does not provide you with any legal rights to any intellectual property in any Microsoft product. You may copy and use this document for your internal, reference purposes. © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, and Windows Live are trademarks of the Microsoft group of companies. All other trademarks are property of their respective owners.
touchdevelop api
locationo many location sources
• Wi-Fi
• cellular radio
• GPS (high accuracy, high power consumption)
o plan for unavailability of location data
touchdevelop api
mapso many map providers
• we use Bing maps
o many provided services• show location
• annotate maps (pictures, lines, …)
• compute directions
touchdevelop api
apiso Senses→current location
Gets the current phone location.o Senses→current
location accurateGets the current phone location with the most accuracy. This includes using services that might charge money, or consuming higher levels of battery power or connection bandwidth.
o Locations→create locationCreates a new geo coordinate location
o Locations→search locationLooks for the coordinate of an address using Bing.
o Picture→locationGets the location where the picture was taken; if any.
o Link→locationGets the location if any
o Place→locationGets the location of the place
o Appointment→locationGets the location
o Message→locationGets the geo coordinates
o String→to locationParses the string as a geo coordinate. returns 'unknown' if parsing fails.
touchdevelop api
apiso Senses→current location
Gets the current phone location.o Senses→current location
accurateGets the current phone location with the most accuracy. This includes using services that might charge money, or consuming higher levels of battery power or connection bandwidth.
o Locations→create locationCreates a new geo coordinate location
o Locations→search locationLooks for the coordinate of an address using Bing.
o Picture→locationGets the location where the picture was taken; if any.
o Link→locationGets the location if any
o Place→locationGets the location of the place
o Appointment→locationGets the location
o Message→locationGets the geo coordinates
o String→to locationParses the string as a geo coordinate. returns 'unknown' if parsing fails.
touchdevelop api
apiso Location→latitude
Gets the latitude of the coordinateo Location→longitude
Gets the longitude of the coordinateo Location→distance
Calculates the distance in meterso Location→speed
Gets the speed of the coordinateo Location→share
Shares the location (email, sms, facebook, social or “” to pick from a list)
o Location→altitudeGets the altitude of the coordinate
o Location→hor accuracyGets the horizontal accuracy of the coordinate
o Location→vert accuracyGets the vertical accuracy of the coordinate
o Location→courseGets the course of the coordinate
o Location→to stringConverts to a string lat,long
o Location→post to wallDisplays the location in a map using Bing.
o Locations→describe locationLooks for an address near a location using Bing.
touchdevelop api
apiso Maps→create map
Creates a Bing map. Use 'post to wall' to display it.o Maps→directions
Calculates the directions between two coordinates using Bing.o Maps→open directions
Shows the directions in the Bing map application. If search term is provided, location is ignored. Provide search term or location for start and end.
o Maps→open mapOpens the Bing map application. zoom between 0 (close) and 1 (far).
o Maps→create full mapCreates a full screen Bing map. Use 'post to wall' to display it.
touchdevelop api
apiso Map→add text
Adds a text pushpin on the mapo Map→add line
Adds a polyline that passes through various geocoordinates
o Map→add pictureAdds a picture pushpin on the map
o Map→add placeAdds a place pushpin on the map (ignored if the location is not set)
o Map→add linkAdds a link pushpin on the map (ignored if the location if not set)
o Map→add messageAdds a message pushpin on the map (ignored if the location is not set)
o Map→set centerSets the map center location
o Map→set zoomSets the zoom level from 1 to 21
o Map→centerGets the map center location
o Map→clearClears the lines, regions and pushpins
o Map→view pushpinsChanges the current zoom and center so that all the pushpins are visible.
o Map→zoomGets the zoom level
o Map→fill regionFills a region with a color
o Map→post to wallDisplays the map in the wall using Bing.
touchdevelop api
exampleso go to picture
☁ http://touchdevelop.com/gpona o location and maps
☁ http://touchdevelop.com/qvci o park and find
☁ http://touchdevelop.com/kvmi
touchdevelop api
exercises►write a script with three executable actions:
• init: sets a global variable to an empty location collection
• record: adds current location to collection (can be called multiple times)
• show: show map where all a line connects all recorded locations
touchdevelop api
homework►finish exercise if not yet finished