Google Map offline in web application - google-maps

How to download all the images in google map to avail the offline access forever in the web application?
I can able to perform the online operations using
src="//maps.googleapis.com/maps/api/js?sensor=false&language=en"
but I need Offline access forever by downloading everything once in online.

I am afraid the solution that you try to implement is against of the terms of service. Please refer to paragraphs 10.1 (a):
No access to APIs or Content except through the Service. You will not access the Maps API(s) or the Content except through the Service. For example, you must not access map tiles or imagery through interfaces or channels (including undocumented Google interfaces) other than the Maps API(s).
and 10.5 (d) of ToS:
No caching or storage. You will not pre-fetch, cache, index, or store any Content to be used outside the Service, except that you may store limited amounts of Content solely for the purpose of improving the performance of your Maps API Implementation due to network latency (and not for the purpose of preventing Google from accurately tracking usage), and only if such storage:
is temporary (and in no event more than 30 calendar days);
is secure;
does not manipulate or aggregate any part of the Content or Service; and
does not modify attribution in any way.
https://developers.google.com/maps/terms#10-license-restrictions
The offline access via Maps JavaScript API is not available at the moment. There is a feature request in the public issue tracker:
https://issuetracker.google.com/issues/35827808
Please star this feature request to express your interest and receive further updates from Google.

Related

is there a way to know how many lanes in a road?

Currently, I'm working on a Mapping Project , and I'd like to know if there's a way to know how many lanes in a single road (same direction), using one of Maps API, like google map. Because at the end I have to display if a lane is blocked, which kind of vehicles can go on a lane, and also the speed limit. But for now I just need to display the number of lanes.
For my application, I'm using Xamarin and Xamarin.forms.maps to display the map and also the Plugin.geolocator for some geolocation informations.
This feature has been requested in the Issue Tracker of Google Maps APIs. However, the request has been rejected as it will violate the compliance of the Google Maps Platform Terms of Service.
They said in the request:
Unfortunately, exposing this in the Directions API would encourage use
of the Maps APIs in ways that would not be in compliance with the
Google Maps/Google Earth APIs Terms of Service at
https://developers.google.com/maps/terms#10-license-restrictions
10.4 Restrictions on Unfair Exploitation of the Service and Content.
c. Restrictions on your Maps API Implementations.
iii: No navigation. You will not use the Service or Content for or in
connection with (a) real-time navigation or route guidance; or (b)
automatic or autonomous vehicle control.
You may check the Feature Request here.
This is only applicable to Google Maps Platform, I'm not sure though with other Maps provider. Hope this helps.

How to cache Google Maps?

Im trying to cache Google Maps Api, to reduce requests.
In their optimize recommendations they write about web-server proxying.
I made it with nginx. Cached everything in the world, but not these requests to Google Maps Api!
I saved locally script of Google Maps, it cached, but it sends requests from its inside.
I see in development console, for example, tiles of map loaded from "memory cache", but requests still counting in google dashboard.
I heard, its not possible, but they wrote about caching in their official docs.
Where I can read about this? What I can do?
You can't.
The only part of the Google Maps API you can cache is certain geocoding results (and even then, only certain results, and only for a limited time). There is no way to cache the interactive maps on your server.
Do not attempt to cache any Javascript or other content used to display Google Maps in the browser. The contents of those scripts may change without notice, and many of your visitors will have those scripts in their browser cache already (e.g, from visiting other web sites which use Google Maps).

Save static browser image to local folder

I am using the Google Static Maps API, to construct a URL with the necessary parameters, which then displays in the browser.
https://developers.google.com/maps/documentation/staticmaps/
How can I automatically save the static map image which is displayed in the browser?
Currently, I have to right-click over image and 'Save image as...', in order to get the image into the required folder. I would like to automate this last step.
Here is a sample URL:
https://maps.googleapis.com/maps/api/staticmap?&size=600x600&maptype=roadmap&scale=1&markers=color:red|label:S|610+Beech+St+W,Whitby&markers=color:blue|label:1|43.8764737,-78.945162&markers=color:blue|label:2|43.8975446,-78.9429329&markers=color:blue|label:3|43.8828564,-78.9294267&markers=color:blue|label:4|43.8828564,-78.9294267&markers=color:blue|label:5|43.903265,-78.956063&markers=color:blue|label:6|43.8780157,-78.9590955&markers=color:blue|label:7|43.886099,-78.952875&key=AIzaSyC5FiaYcLsRwaSxOhcOzqejdN_xzCwVIJ8
This use case might be in contradiction with Google Maps API Terms of Service. Section 10.5 (d) states:
No caching or storage. You will not pre-fetch, cache, index, or store any Content to be used outside the Service, except that you may store limited amounts of Content solely for the purpose of improving the performance of your Maps API Implementation due to network latency (and not for the purpose of preventing Google from accurately tracking usage), and only if such storage:
is temporary (and in no event more than 30 calendar days);
is secure;
does not manipulate or aggregate any part of the Content or Service; and
does not modify attribution in any way.
https://developers.google.com/maps/terms#section_10_5
Just an update to where you can find the relevant terms of service now:
3.2.3 Restrictions Against Misusing the Services.
(a) No Scraping. Customer will not export, extract, or otherwise scrape Google Maps Content for use outside the Services. For example, Customer will not: (i) pre-fetch, index, store, reshare, or rehost Google Maps Content outside the services; (ii) bulk download Google Maps tiles, Street View images, geocodes, directions, distance matrix results, roads information, places information, elevation values, and time zone details; (iii) copy and save business names, addresses, or user reviews; or (iv) use Google Maps Content with text-to-speech services.
(b) No Caching. Customer will not cache Google Maps Content except as expressly permitted under the Maps Service Specific Terms.

Google Maps Static API is asking for API Key

When using the google maps static API service, all my requests are showing up as a 403 Forbidden. When taking a look at my request, I notice this error message: "The Google Maps API server rejected your request. This service requires an API key."
The code that is calling the service is below:
<img src="http://maps.googleapis.com/maps/api/staticmap?center=Albany,+NY&zoom=13&scale=false&size=600x300&maptype=roadmap&format=png&visual_refresh=true" alt="Google Map of Albany, NY">
I've used the static map service before and it worked fine and easily. But for some reason, all my requests show up as a 403 now? I've never had to use an API key in the past. If I do use an API key with this call, it works.
What is going on here?
The Google Static Maps API now requires a key (as of June 22, 2016), existing applications should be "grandfathered" with keyless access. See this blog post for more information (relevant text below):
As of June 22, 2016 we are making the following changes to the Google Maps APIs Standard Plan:
We no longer support keyless access (any request that doesn't include an API key). Future product updates are only available for requests made with an API key. API keys allow us to contact developers when required and help us identify misbehaving implementations.
We have implemented a simple 25,000 map loads per day free limit to new Google Maps JavaScript API, Static Maps API, and Street View Image API implementations. The confusing 90-consecutive-day grace period for these APIs is being retired on October 12, 2016. With this change, developers can predictably plan for growth while media sites and US nonprofits can request more quota at no charge via our dedicated support programs.
We have reduced the daily map load maximum limit you can purchase for Google Maps JavaScript API, Static Maps API, and Street View Image API from 1,000,000 to 100,000 requests per API.* We believe higher-volume developers are best served with a Premium Plan license, which includes technical support and a Service Level Agreement, and with this change we've also created consistency between Standard Plan quotas across our maps and web service APIs.
We now count Google Maps JavaScript API client-side requests towards the daily limit of the associated web service API.*
The new policies will apply immediately to all Maps API implementations created on or after June 22nd, 2016.
Existing applications have been grandfathered based on their current usage to ensure that they continue to function both now and in the future. We will also be proactively contacting all existing API key users who, based on usage growth patterns, may be impacted in the future. If you’re an existing user, please take the time to read our Policy Update for Standard Plan summary for details on how each of these changes might affect your implementation.

Do Google API keys work with Google Maps web services, e.g. geocoding?

I'm using Google Maps web services to perform server-side (reverse) geocoding.
I've got a browser-side and server-side Google API key from the Google APIs Console, which permits the Google Maps JS API to use higher request quotas, and enables pay-per-use for overages (successfully tested in-browser via JS). But the server-side key doesn't seem to work on web services requests.
For example, this URL works fine:
http://maps.googleapis.com/maps/api/geocode/json?sensor=true&latlng=43.477329,-80.548601
But if you add a "key=..." parameter, as in the other APIs, I get a REQUEST_DENIED status.
Am I doing something wrong, or is this just not supported on the web services APIs (yet)? Will it be supported in the future?
See also
request_denied when i include key=my_api_key
Nope, you're not doing anything wrong.
Unfortunately, enforcing tight limits on the Google Geocoding API, also called "Server-Side Geocoding", is Google's design. If your app needs more than 2,500 Server-Side Geocodes per day, then you'll need to upgrade to their Google Maps API for Business product.
Hold on, it gets worse.
If your app's server IP address is shared with other apps, that 2,500 request daily limit applies to ALL of them. This includes apps that share the same server IP address as you, but don't belong to you! This can be a common situation with any PaaS, like Google App Engine or Heroku. So, even if your app works flawlessly today, there is no guarantee that it's still going to work tomorrow.
In the article, "Geocoding Strategies", Google indicates the solution is to "almost always" use "Client-Side Geocoding" via the Geocoding Service, part of the Google Maps JavaScript API V3. The primary reason is that limits are enforced per user, per session. Requests like this shouldn't run up against quota limits unless you're executing geocode batches on the client (not a typical use case).
One golden nugget from the "Geocoding Strategies" article: Design a page that takes user input, calls the client-side Geocode service method, then passes that information to your server app where it can be processed, and hopefully cached. This is FAR from ideal, but if upgrading to Google Maps API for Business isn't an option, it might be the only way to go.
Good luck!
According to this post, your API key should work as one of the three option for requests over 25,000 loads per day.
https://developers.google.com/maps/faq#usagelimits