Android: how to get an image of a location with latitude and longitude

717 views Asked by At

On iOS, when we have a location's latitude and longitude, we can use MKMapSnapshotter to create an image. How to achieve this on Android?

In the screenshot below from an iOS app, a snapshot of the map can be created with a latitude and a longitude.

enter image description here

1

There are 1 answers

1
qqNade On BEST ANSWER

You can use "google static map" to get an image with location by coordinates.

You can load the generated image by creating a URL request, for example:

String url = "http://maps.google.com/maps/api/staticmap?center=" + latitude + "," + longitude + "&zoom=15&size=300x300&sensor=false&key=YOUR_API_KEY"

Furthermore, you can dive into the documentation of static maps. https://developers.google.com/maps/documentation/maps-static/overview