How to use the OGC WMTS service in your map with OpenLayers
This tutorial shows how to add an OGC WMTS from MapTiler Cloud to your web map using OpenLayers. The easiest way to add a WMTS to a map is to get the configuration information directly from the GetCapabilities response.
-
Copy the following code, paste it into your favorite text editor, and save it as a
.html
file. -
Replace YOUR_MAPTILER_API_KEY_HERE with your actual MapTiler API key.
-
The next is up to you. You can center your map wherever you desire (modifying the
starting position
) and set an appropriate zoom level (modifying thestarting zoom
) to match your users’ needs. Additionally, you can change the map’s look (by updating thesource URL
); choose from a range of visually appealing map styles from our extensive MapTiler standard maps, or create your own to truly differentiate your application. -
Create the WMTS capabilities parser.
-
Get the WMTS Capabilities information and read it with the parser.
-
Change the
source
to use the WMTS
Learn more
If you want to learn more about OGC WMTS check out the WMTS article.