I have a OpenStreetMap for base layer in my website. How can I adding GoogleMaps to base layer, I already have the license API Key.
My base layer OSM:
var map = new ol.Map({
view: mapView,
layers: [
new ol.layer.Tile({
source: new ol.source.OSM({
attributions: [
' © Powerby: <a href="https://xx.xxx.vxx/" target="_blank">Me</a>',
ol.source.OSM.ATTRIBUTION
]
})
})
],
target: 'map',
visible:true,
title: 'Base Layer',
});
ol.source.XYZ
to construct your layer source. Info of how to constructurl
option: developers.google.com/maps/documentation/tile/request-tile. Here is an example of usingol.source.XYZ
tile source: openlayers.org/en/latest/examples/xyz.html