how to consult Distance Matrix with geocoder together?

Asked

Viewed 37 times

0

I am developing an application that uses the google API to display the registered places on the map along with the distance of each location as follows.

mMap.addMaker(new MarkerOptions().position(latLng).title(nome do local).snippet(distancia do local));

Even everything ok, but for this I am obliged to use two distinct Apis, the Matrix Istance (to take the distance) and the Geoconding (to pick up the location, since I only have the address of the place, and not your Latlng).

I wonder if it is possible to join these two Apis to achieve the distance and the Latlng of the site at the same time, otherwise the amount of requisitions can end up extrapolating a lot.

  • What kind of distance do you want? It’s straight?

  • could be, but the ideal would be the time to accomplish the route

  • If it’s straight, you can, if you have objects like Location, use distanceTo(Location dest) or use Google Maps Sphericalutil Android API Utility Library, if you have objects like Latlng, see this reply.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.