Google Map API download map

my question for professionals I think may be stupid but I had a problem which regards to search for my solution for my problem. Technically I am developing social networking site and I want to integrate Google Map API and my question is, is there any way that I can download the crop image so that it stores to my server so that my web server doesn't need to request to Google Server again. If not, can you give an alternative solution that may fit to may problem and If yes can you give a hint or tip which it could possibly usable to my development process. I am newly in such Web API. Thank you. Regards

Upvotes: 0

Views: 3041

Answers (2)

qwertmax
qwertmax

Reputation: 3450

try to use something like this

<img src="https://maps.googleapis.com/maps/api/staticmap?center=-15.800513,-47.91378&zoom=11&size=200x200&sensor=false">

will look like

Upvotes: 1

aleation
aleation

Reputation: 4844

Using the static map api it will return you an img, then you can save it easily as a normal image, but my recomendation is just to have columns with the user's location stored in your database, the address or the coordinates (lat,lng).

Later on when you want to display the map just request it from google using the staticmap or the javascript v3 API.

Advantages:

  1. You save bandwidth and storage space
  2. Easier maintaining of your database and or files structure
  3. Google's server probably has better response time and speed than yours
  4. More dynamic: reverse-geocoding the location or using the coordinates you can display the static map, the normal map (which is not hard, I can tell you), Street View, Google earth and probably a lot of other stuff
  5. You are not going against the Rules

Disadvantages:

Google's daily limits, which are up to 2500 or 1000 requests per day and 10 per second, you can look it up I don't remember. But, if you use tha JavaScript v3 to display the map, the prints are counted on the browser, so it would be 1000(in the worst case) prints per browser(per ip actually), so that means that each user can print 1000 maps per day. It's not really a problem, if your site gets that many views you are doing great xD

Upvotes: 0

Related Questions