Augmented reality (AR) Control for MapTiler SDK JS
This Augmented reality (AR) control adds a button on your MapTiler SDK’s map to create a 3D model of the viewport, including 3D terrain and any layer you have put on top.
The Enable AR button will appear if your device is compatible with WebXR or Apple Quick Look. Then, you can position and interact with the 3D model in your own space!
Get started
-
Since the AR control is going to be added to a Map, let’s instantiate a map first. 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. -
Waiting for the map to be ready to add the control.
-
Install the npm package.
-
Include the CSS file.
If you have a bundler that can handle CSS, you can
import
the CSS or include it with a<link>
in the head of the document via the CDN -
Include the following code in your JavaScript file (Example: app.js).
-
Replace
YOUR_MAPTILER_API_KEY_HERE
with your actual MapTiler API key. -
Waiting for the map to be ready to add the control.
API Reference
This reference documents every object and method available. Each section describes classes or objects as well as their properties, parameters, methods, and associated events. Many sections also include inline code examples and related resources.