You are viewing an older version of MapQuest-GL.js. Check out the latest version.
MapQuest-GL.js is a JavaScript library for interactive maps, geocoding, directions, and traffic. MapQuest-GL.js is powered by the MapQuest APIs.
To get started, first include MapQuest-GL.js and MapQuest.css in your HTML header.
<script src="https://api.mqcdn.com/sdk/mapquest-gl-js/v0.4.0/mapquest-gl.js"></script>
<link type="text/css" rel="stylesheet" href="https://api.mqcdn.com/sdk/mapquest-gl-js/v0.4.0/mapquest-gl.css"/>
Then define a MapQuest map object with your MapQuest key, with center, zoom, pitch, and bearing values.
var map = new mqgl.Map('map', 'KEY', {
center: [-122.2082454,37.4780123],
zoom: 13,
pitch: 60,
bearing: 0
});
map.load(function() {
setTimeout(function() {
map.map.flyTo({speed: 0.5, zoom: 15, pitch: 60, bearing: 180, center: [-122.3989808,37.7517676]})
}, 2000);
});
You'll need to sign up for an account with MapQuest. An API key is provided upon sign up and is required when accessing MapQuest services.
Sign UpOnce you have an account, get started making. We have tons of APIs to try including Mapping, Geocoding, Directions, and Search.
Grab the Key