Skip to content

Instantly share code, notes, and snippets.

double latitude = -23.65465;
double longitude = -46.45675;
Point point = new Point(latitude, longitude);
view.startMapOn(<coloque_seu_token_aqui>, <ponto_inicial>);
[mapTemplate drawRoute:routeInfo];
RouteInfo * routeInfo = [RouteQuery doRoute:route withToken:TOKEN];
MLRoute *route = [[MLRoute alloc] initWithStartGeocodedAddress:startAddress
andEndGeocodedAddress:endAddress
andRouteOptions:routeOptions];
MLRouteOptions * routeOptions = [[MLRouteOptions alloc]
initWithRouteStyle:[MLRouteStyle FASTEST]
andUnitOfMeasurement:[MLUnitOfMeasurement KM]];
//Cria endereço de saída
MLAddress *saida = [[MLAddress alloc]
initWithStreet:@"Rua Funchal"
andBuildingNumber:@"129"
andNeighborhood:@"Vila Olímpia"
andCity:@"São Paulo"
andState:@"SP"
andPostalCode:nil];
MLGeocodedAddress *startAddress = [[MLAddressGeocoder geocodeWithToken:TOKEN address:saida]objectAtIndex:0];
map.drawRouteOnMap(routeInfo);
RouteInfo routeInfo = null;
try {
//Calcula a rota
routeInfo = RouteQuery.doRoute(token, route);
} catch (CouldNotCompleteRouteException e) {
e.printStackTrace();
}
Route route = new Route(geocodedStartAddress.get(0), geocodedEndAddress.get(0), routeOptions);