[GIS] Accessing Google Tile independent from their API in OL3 is possible for paying customer

google mapsgoogle-maps-apiopenlayers

Using map from tile providers are common use-case in web mapping: overlaying internally-hosted WMS/WFS layer on top of Google Maps/OSM/Bing Maps. These are easy in OpenLayers 2. However, this feat -especially Google Maps- is not supported anymore in OL3.

The book "OpenLayers 3 Beginner's Guide" page 107:

OpenLayers 2 had some third-party mapping APIs embedded into its core,
enabling you to use its maps inside your Openlayers-based application.
Nowadays, for better decoupling of OpenLayers API from third-party
APIs, the OpenLayers 3 team choose to have no support for other
mapping APIs that tie together tiles and an associated JavaScript API
library.

Why this decision?

One of the main goals of OpenLayers 3 was
to rewrite OpenLayers 2, making its API cleaner. The support for
Google Maps API in OpenLayers 2 has also put a significant maintenance
burden on both library and application developers, to keep up with
changes of the Google Maps API. To avoid this in OpenLayers 3, the
support for Google Maps using Google Maps API is nonexistent. However,
Google does provide its tiles independent from their API, but only to
paying customers.
Fortunately, you have more alternatives to Google
Maps API (Bing, OSM).

Can anyone elaborate more on:

  1. how OL3 can access Google Maps tile independent from their API ?
  2. what sort of payment/contract ? Is it the same with the Google Maps API Premium ?

=================== added 6 June 2017 ==============

I found this awesome solution in OpenLayers. I tried it myself that it works with OpenLayers 4.1.1 and Leaflet 0.7.7.

Now i was wondering if this solution is the answer of my question #1 ?

Best Answer

I'm one of the author of the book you are mentioning. It seems it's an error in the book we missed when reviewing the final content (or maybe we were thinking when writing to tiles from the dead Google Earth Engine)

You can access Google Maps tiles directly technically (your link) but you can't legally as you will go against the Google Maps API TOS (they state you must use the Google Maps API to access their tiles if you pay or not ,see comments on https://stackoverflow.com/a/33993878/768440 for TOS) Addition: you need to set a mandatory key since 11th June, 2018.

The two alternate legal ways are:

Code like life is all about compromises, in this case due to legal and technical aspects. Just make your choice :)