0

I am using OpenLayers library version 7.2.2 for a client. The client wants Google Maps to be integrated in the system and also has provided with an API key. How can I load the maps using the API key? I was loading Google Maps free version with below mentioned code:

source: new XYZ({
        url: 'http://mt1.google.com/vt/lyrs=m@113&hl=en&&x={x}&y={y}&z={z}',
      })

How to load all four versions of google maps using above logic?

3

1 Answer 1

3

Found a solution provided by Google Customer Support. Just need to add the API key at the end.

source: new XYZ({
  url: 'http://mt1.google.com/vt/lyrs=m@113&hl=en&&x={x}&y={y}&z={z}&key=YOUR_API_KEY_HERE',
})

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.