When was the last time you were truly lost? Thanks to the maps and location technology in our phones, a whole generation has now grown up in a world where getting lost is truly a thing of the past. Location technology goes far beyond maps in the palm of our hand, however. In this talk, we will explore how a ridesharing app works. How do we discover our destination?How do we find the closest driver? How do we display this information on a map? How do we find the best route?To answer these questions,we will be learning about a variety of location APIs, including Maps, Positioning, Geocoding etc.
30. We are currently at 52.38326, 4.92032. What does that mean?
Latitude & Longitude
Latitude Longitude
Equator
Prime Meridian
+60
-30
-90 (South)
+90 (North) 180
-120 (West)
+30 (East)
53. "Where are the drivers?"
Pickup: 72 Noble St, Brooklyn
Positioning API
54. "Where am I going?"200 Central Park W
Pickup: 72 Noble St, Brooklyn
55. "Where am I going?"200 Central Park W
Pickup: 72 Noble St, Brooklyn
200 Central Park W, New York
200 Central Park S, New York
200 Central Park N, New York
200 Central Ave, Brooklyn
56. Geocoder
Autocomplete API
200 Central Park W
Pickup: 72 Noble St, Brooklyn
200 Central Park W, New York
200 Central Park S, New York
200 Central Park N, New York
200 Central Ave, Brooklyn
"Where am I going?"
61. {
"suggestions": [
{
"label": "United States, NY, New York, 200 Central Park W",
"language": "en",
"countryCode": "USA",
"locationId": "NT_srx4m-dHrwiUBDnXi3NAwD_yADM",
"address": {
"country": "United States",
"state": "NY",
"county": "New York",
"city": "New York",
"district": "Upper West Side",
"street": "Central Park W",
"houseNumber": "200",
"postalCode": "10024"
},
"matchLevel": "houseNumber"
},
{
"label": "United States, NY, New York, 200 Central Park S",
...
},
...
]
}
62. "Where am I going?"american museum of
Pickup: 72 Noble St, Brooklyn
American Museum of Natural History
American Museum of the Moving Image
Museum of the American Gangster
Museum of Chinese in the Americas
63. Places API
american museum of
Pickup: 72 Noble St, Brooklyn
American Museum of Natural History
American Museum of the Moving Image
Museum of the American Gangster
Museum of Chinese in the Americas
"Where am I going?"
64. DiscoveryRequest request = new SearchRequest("american museum of");
GeoCoordinate manhattan = new GeoCoordinate(40.71451, -74.00602);
request.setSearchCenter(manhattan);
request.setCollectionSize(5);
request.execute(new SearchRequestListener());
class SearchRequestListener implements ResultListener<DiscoveryResultPage> {
@Override
public void onCompleted(DiscoveryResultPage data, ErrorCode error) {
List<DiscoveryResult> items = data.getItems();
for (DiscoveryResult item : items) {
PlaceLink placeLink = (PlaceLink) item;
// display information
}
}
}
65. DiscoveryRequest request = new SearchRequest("american museum of");
GeoCoordinate manhattan = new GeoCoordinate(40.71451, -74.00602);
request.setSearchCenter(manhattan);
request.setCollectionSize(5);
request.execute(new SearchRequestListener());
class SearchRequestListener implements ResultListener<DiscoveryResultPage> {
@Override
public void onCompleted(DiscoveryResultPage data, ErrorCode error) {
List<DiscoveryResult> items = data.getItems();
for (DiscoveryResult item : items) {
PlaceLink placeLink = (PlaceLink) item;
// display information
}
}
}
66. "How long does it take?"
"How much does it cost?"
"What is the route?"
american museum of
Pickup: 72 Noble St, Brooklyn
American Museum of Natural History
American Museum of the Moving Image
Museum of the American Gangster
Museum of Chinese in the Americas
67. "How long does it take?"
"How much does it cost?"
"What is the route?"
Confirm ride
28 min - $24 - $29
68. Routing API
"How long does it take?"
"How much does it cost?"
"What is the route?"
Confirm ride
28 min - $24 - $29
69. CoreRouter router = new CoreRouter();
RoutePlan routePlan = new RoutePlan();
routePlan.addWaypoint(new RouteWaypoint(
new GeoCoordinate(40.728215,-73.958251)));
routePlan.addWaypoint(new RouteWaypoint(
new GeoCoordinate(49.1947289, -123.1762924)));
RouteOptions routeOptions = new RouteOptions();
routeOptions.setTransportMode(RouteOptions.TransportMode.CAR);
routeOptions.setRouteType(RouteOptions.Type.FASTEST);
routePlan.setRouteOptions(routeOptions);
router.calculateRoute(routePlan, new RouteListener());
70. CoreRouter router = new CoreRouter();
RoutePlan routePlan = new RoutePlan();
routePlan.addWaypoint(new RouteWaypoint(
new GeoCoordinate(40.728215,-73.958251)));
routePlan.addWaypoint(new RouteWaypoint(
new GeoCoordinate(49.1947289, -123.1762924)));
RouteOptions routeOptions = new RouteOptions();
routeOptions.setTransportMode(RouteOptions.TransportMode.CAR);
routeOptions.setRouteType(RouteOptions.Type.FASTEST);
routePlan.setRouteOptions(routeOptions);
router.calculateRoute(routePlan, new RouteListener());
71. CoreRouter router = new CoreRouter();
RoutePlan routePlan = new RoutePlan();
routePlan.addWaypoint(new RouteWaypoint(
new GeoCoordinate(40.728215,-73.958251)));
routePlan.addWaypoint(new RouteWaypoint(
new GeoCoordinate(49.1947289, -123.1762924)));
RouteOptions routeOptions = new RouteOptions();
routeOptions.setTransportMode(RouteOptions.TransportMode.CAR);
routeOptions.setRouteType(RouteOptions.Type.FASTEST);
routePlan.setRouteOptions(routeOptions);
router.calculateRoute(routePlan, new RouteListener());
72. CoreRouter router = new CoreRouter();
RoutePlan routePlan = new RoutePlan();
routePlan.addWaypoint(new RouteWaypoint(
new GeoCoordinate(40.728215,-73.958251)));
routePlan.addWaypoint(new RouteWaypoint(
new GeoCoordinate(49.1947289, -123.1762924)));
RouteOptions routeOptions = new RouteOptions();
routeOptions.setTransportMode(RouteOptions.TransportMode.CAR);
routeOptions.setRouteType(RouteOptions.Type.FASTEST);
routePlan.setRouteOptions(routeOptions);
router.calculateRoute(routePlan, new RouteListener());
73. private class RouteListener implements CoreRouter.Listener {
public void onProgress(int percentage) {
// Display a message indicating calculation progress
}
public void onCalculateRouteFinished(List<RouteResult> routeResult,
RoutingError error) {
mapRoute = new MapRoute(routeResult.get(0).getRoute());
map.addMapObject(mapRoute);
updateTextView(routeResult.get(0).getRoute().getLength());
}
}
74. private class RouteListener implements CoreRouter.Listener {
public void onProgress(int percentage) {
// Display a message indicating calculation progress
}
public void onCalculateRouteFinished(List<RouteResult> routeResult,
RoutingError error) {
mapRoute = new MapRoute(routeResult.get(0).getRoute());
map.addMapObject(mapRoute);
updateTextView(routeResult.get(0).getRoute().getLength());
}
}
75. private class RouteListener implements CoreRouter.Listener {
public void onProgress(int percentage) {
// Display a message indicating calculation progress
}
public void onCalculateRouteFinished(List<RouteResult> routeResult,
RoutingError error) {
mapRoute = new MapRoute(routeResult.get(0).getRoute());
map.addMapObject(mapRoute);
updateTextView(routeResult.get(0).getRoute().getLength());
}
}
76. ...
"length": 9919,
"travelTime": 1664,
"maneuver": [
{
"position": {
"latitude": 40.728361,
“longitude": -73.9582743
},
"instruction": "Head toward West St on Noble St. Go for 79 m.",
"travelTime": 15,
"length": 79,
"id": "M1",
"_type": "PrivateTransportManeuverType"
},
{
"position": {
"latitude": 40.7282925,
"longitude": -73.9590061
},
"instruction": "Turn right onto West St. Go for 239 m.",
...
88. $28.27
Thanks for riding with HERE, Richard!
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec ac mi a
sem viverra lobortis. Donec at massa vel nibh lobortis laoreet. Orci varius
natoque penatibus et magnis dis parturient montes, nascetur ridiculus
mus. Praesent finibus facilisis nisi, id consectetur eros scelerisque non.
Suspendisse ut ligula interdum, dictum velit vel, interdum erat. Sed
vulputate laoreet tempus. Sed varius felis sed lorem semper commodo.
89. Thank you for riding with Richard!
Give a compliment?
@sueselbeck
https://developer.here.com/