Map JS API
Move camera with JS API
Fly to positions o the map using the camera and the JS API.
<html> <head> <script src="https://rasters.io/maps/v0.8.0/rasters.map.min.js"></script> <link rel="stylesheet" href="https://rasters.io/maps/v0.8.0/rasters.css" /> <style> html, body { height: 100%; -ms-touch-action: none; } </style> </head> <body> <script> var map; var MapToken = "Enter your MapToken here"; Rasters.Map.OnReady = function () { map = new Rasters.Map({ container: 'Map', // container id url: 'https://api.rasters.io/', mapKey: "", authenticationMode: Rasters.AuthenticationMode.MapToken, token: MapToken }); map.OnReady = OnConnectHander; } function OnConnectHander() { map.SetPosition(-71.2170425, 46.810457, 10); } </script> <div style='width: 100%; height: 400px; position: relative;'> <div id="Map" style='width: 100%; height: 100%;'></div> <div class="btn-group" style="position: absolute; right: 10px; top: 10px;" > <button onclick="map.FlyToPosition(-71.2230425, 46.8171957,14);">Quebec city</button> <button onclick="map.FlyToPosition(-79.3681081, 43.6523898, 9);">Toronto</button> <button onclick="map.FlyToPosition(-123.3676258, 48.4138784, 12);">Victoria</button> </div> </div> </body> </html>
Help Guide Powered by Documentor