Introduction to Map and Location APIs (Silicon Valley Code Camp 2017)
Post on 22-Jan-2018
81 Views
Preview:
Transcript
Where amI?
We’re never really lostanymore.
LocationTechnology
Locationtechnology is anintegralpart of our daily lives.
LocationTechnology"80%of alldata is connected to location."
AbrahamLincoln
RichardSüselbeckDeveloperEvangelistHERETechnologies
@sueselbeck#svcc
SiliconValley
CODECAMP
Expectations
developer.here.com
Where amI?
Example:BrowserGeolocation API
navigator.geolocation.getCurrentPosition(function(position) {document.write(position.coords.latitude + ", " +
position.coords.longitude);});
Example:HEREAndroidPositioning API
PositioningManager positioningManager =PositioningManager.getInstance();
positioningManager.start(PositioningManager.LocationMethod.GPS_NETWORK);
GeoPosition position = positioningManager.GetPosition();
Sowe are at37.3723,-121.9222.Whatdoesthatmean?
Latitude&Longitude
Latitude Longitude
Equator
PrimeMeridian
+60
-30
-90(South)
+90(North) 180
-120(West)
+30(East)
How did weget thelocation?
How did weget thelocation?
GPS
How did weget thelocation?
GPS,GALILEO,GLONASS,BeiDou,NAVIC,QZSS
GNSS
How did weget thelocation?
GNSSisn‘t theonly way toget alocation.
Radiosignals:Celltowers,Wifi,Bluetooth,etc
Example:HEREPositioning API
https://pos.api.here.com/positioning/v1/locate?app_id=YOUR_APP_ID&app_code=YOUR_APP_CODE credentials
{ "wlan": [
{"mac": "8C-1A-BF-20-66-AD"}, {"mac": "A0-E4-53-E9-66-A7"}, ... {"mac": "B8-6B-23-09-87-B1"}, {"mac": "F4-55-95-11-2C-C1"}
] }
Where amI?
Use aPositioning API.
Understand the technology the location comes from.Choose therightAPIfortherighttask/device.
WhereamI?By themselves alatitude and longitude aren‘t always helpful.
Their poweris inplacing us onamap.
MapsMakingMapsis hard.
MapsMakingMapsis hard.
Maps
Maps
Map APIs
Map ImageAPI InteractiveMap API
Example:HEREMap ImageAPI
https://image.maps.api.here.com/mia/1.6/mapview?&c=37.37774,-121.92186&z=16&w=640&h=400
centerofthemapzoomlevel
Imagewidthandheight
Example:HEREMap ImageAPI
https://image.maps.api.here.com/mia/1.6/route?&r0=52.540867,13.262444,52.536691,13.264561,52.529172,13.268337,52.528337,13.273144,52.52583,13.27898,52.518728,13.279667&lc0=44ff00ff
waypoints
linecolor
Example:HEREInteractiveMaps APIvar platform = new H.service.Platform({
app_id: ’1234567890',app_code: abcdefghi',useHTTPS: true
});
var defaultLayers = platform.createDefaultLayers();
var map = new H.Map(document.getElementById('map'),defaultLayers.normal.map);
var behavior = new H.mapevents.Behavior(newH.mapevents.MapEvents(map));
var ui = H.ui.UI.createDefault(map, defaultLayers);
WhereamI?2161N.FirstStSanJose,California95131
WhereamI?2161N.FirstStSanJose,California95131
Invalidenstraße 11610245Berlin
Geocoder API
37.37627,-121.9225692161N.FirstStSanJose,California95131
Invalidenstraße 11610245Berlin37.37627,-121.922569
https://reverse.geocoder.api.here.com/6.2/reversegeocode.json?&mode=retrieveAddresses&prox=52.5319841,13.3828921
Example:HEREGeocoder API
https://geocoder.api.here.com/6.2/geocode.json?&searchtext=2161+n+first+st+san+jose+california+95131
returnthecloseststreetaddresslocation(andradius)
What‘s around us?Maps provide context for alocation.
Places(points of interest)are another typeof context.
WheredoIwant togo?
Locationisn‘t justabout where youare.It‘s about where you‘re going.
Example:HEREPlacesAPI
// creates a Search entrypointvar search = new H.places.Search(platform.getPlacesService());// creates parameters for search requestvar params = {
'q': 'starbucks','at': '37.3720,-121.9221'
};// creates a request with callbackssearch.request(params, {}, onResult, onError);
function onResult(result) {}
function onError(error) {}
Example:HEREInteractiveMaps API
var group = new H.map.Group();
group.addObjects(places.map(function (place) {var marker = new H.map.Marker({lat: place.position[0],
lng: place.position[1]})return marker;
}));
map.addObject(group);
map.setViewBounds(group.getBounds());
How doIget there?Findyour way using the RoutingAPI.
Example:HERERoutingAPI
https://route.api.here.com/routing/7.2/calculateroute.json?waypoint0=37.377,-121.921&waypoint1=37.615,122.393&mode=fastest;car;traffic:enabled
startandendpoint
routingmode
What can Ireach?Isoline RoutingAPI
Which places can adelivery truck or taxi reach within 15minutes?
Example:HEREIsoline RoutingAPI
#07
var routingParams = { 'mode': 'fastest;car;', 'start': '37.80531,-122.4161', 'range': '900', 'rangetype': 'time'
};
var router = platform.getRoutingService();
router.calculateIsoline(routingParams,onResult,onError;});
Locationis solved!(sort of)
But:TheFutureis coming!
TheFuture™
10BillionPeople
GiantCities
Autonomous cars
Autonomous everything!
Everything is asensor! Newmobility concepts
HEREOpenLocationPlatform
@sueselbeck#svcc
Thank you!!
Abesays:“Signupondeveloper.here.com!”
top related