We've all gotten lost at some point in our lives. Finding out where we are, where we want to go, and how to get there is hard enough for people, but it’s even harder for our applications and devices.
Fortunately, map and location APIs are here to help. From latitudes to longitudes, from geocoding to routing, in this session you'll learn to go beyond maps and help your apps and devices find their way using location technology.
30. Example: HERE Interactive Maps API
var 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(new
H.mapevents.MapEvents(map));
var ui = H.ui.UI.createDefault(map, defaultLayers);
37. Example: HERE Places API
// creates a Search entrypoint
var search = new H.places.Search(platform.getPlacesService());
// creates parameters for search request
var params = {
'q': 'starbucks',
'at': '37.3720,-121.9221'
};
// creates a request with callbacks
search.request(params, {}, onResult, onError);
function onResult(result) {}
function onError(error) {}
38. Example: HERE Interactive Maps 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());