How can I extract a satellite image from google maps given a Lat Long Rectangle? (or, two (lat,long) points that form a bounding box).
First, open Google Maps on your computer, right-click the place you want to get coordinates. A pop-up window will show, you can find the latitude and longitude on the top. Left-click and copy them automatically.
How to use Google maps static API to extract a Terrain(Satellite), Road,...etc map?
You need a google account & an API_KEY to use the google maps static API
Login to your google account
After login open another tab and browse the google developer console. https://console.developers.google.com
Create or use an existing API key
4.1 Once you are in the console dashboard, navigate to “Enable APIs and get credentials like keys”
4.2 In the API manager tab, select Credentials
4.3 Once you are in the Credentials menu, select “Add credentials” and select API key in the drop down
4.4 In the next menu select key type as Browser
4.5 Provide a name to your key and click create.
4.6 Copy the key value and use it in all request to google maps API
Go to Google maps static API for google developers documentation.
https://developers.google.com/maps/documentation/static-maps/intro?hl=en
This documentation explains everything you need to know about the maps API
The Google Maps API is a web service that we can call by using a URL shown in the following example. Use the URL with your API_KEY to get the map of New York city
Google Static Map API Service URL
https://maps.googleapis.com/maps/api/staticmap?parameters
Replace the parameters with your prefered location parameters & your API key
https://maps.googleapis.com/maps/api/staticmap?center=Brooklyn+Bridge,New+York,NY&zoom=13&size=600x300&maptype=roadmap&markers=color:blue%7Clabel:S%7C40.702147,-74.015794&markers=color:green%7Clabel:G%7C40.711614,-74.012318&markers=color:red%7Clabel:C%7C40.718217,-73.998284&key=YOUR_API_KEY
To find the parameters like “center” for your preferred location
Go to google maps
https://www.google.lk/maps
Search for your prefered location with name of a city, road or another significant location information. I have searched for my home town main junction “Kurunegala Junction”
Once you have found the location on google maps, copy the browse URL into text file
https://www.google.lk/maps/place/Kurunegala+Junction/@7.480785,80.3402663,14z/data=!4m2!3m1!1s0x0000000000000000:0x4ef85a8455d1d21c
In the copied URL, copy the Longitude & Latitude into the Google static map API URL as depicted in the below URL(size parameter is required)
https://maps.googleapis.com/maps/api/staticmap?center=7.480785,80.3402663&zoom=12&size=400x400&key=YOUR_API_KEY
Now modify the above URL with other parameters that are required If you want both terrain and roadmap, set the parameter “maptype” as hybrid
https://maps.googleapis.com/maps/api/staticmap?center=7.480785,80.3402663&zoom=12&size=400x400&maptype=hybrid&key=YOUR_API_KEY
To get a list of available parameters, refer the google map static API documentation.
https://developers.google.com/maps/documentation/static-maps/intro?hl=en
try with:
https://maps.googleapis.com/maps/api/staticmap?center=17.053828,+-96.700116&zoom=17&scale=1&size=600x300&maptype=satellite&format=png&visual_refresh=true
you can change lat, lng params in your app =).
Add your key API.
https://maps.googleapis.com/maps/api/staticmap?center=17.053828,+-96.700116&zoom=17&scale=1&size=600x300&maptype=satellite&format=png&visual_refresh=true&key=YOUR_KEY_API
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With