Create a Static Map

Create a unique static map image link to display on your website, blog, or online content.

For more information about the MapQuest Static Map API visit https://developer.mapquest.com/documentation/static-map-api/v5.

Add a Location to the Map

Add Directions to the Map

Interactive Map

Pan, zoom, change map tiles, and edit icons for your static map

Map Summary

Locations

Directions

View Static Map

Map Options

Static Map Preview

Edit Static Map

This code is your static map image seen above, use it in HTML or CSS

https://www.mapquestapi.com/staticmap/v4/getmap?size=600,500&type=map&zoom=7&center=39.740112,-104.984856&imagetype=JPEG&key=YOUR_KEY_HERE

'; } } function getStartingLocation() { return createLocationFromForm('start'); } function getEndingLocation() { return createLocationFromForm('end'); } function geocodeWithCustomIcon(locationObject, id, iconName) { MQ.geocode() .search(locationObject) .on('success', function(e) { var best = e.result.best; var latlng = best.latlng; var iconObject = new Icon(id); iconObject.name = iconName; var popup = L.marker(latlng, { icon: iconObject.createLeafletIcon(), draggable: true }); markerManager.addMarker({ id: id, latlng: latlng, marker: popup, iconObject: iconObject, }); popup.on('dragend', function(event) { markerManager.removeMarker(id); var marker = event.target; var position = marker.getLatLng().wrap(); markerManager.addMarker({ id: id, latlng: position, marker: marker, iconObject: iconObject, }); doPrint(); }); var markerGroup = L.featureGroup(markerManager.getLeafletMarkers()); map.fitBounds(markerGroup.getBounds()); doPrint(); }); } function geocode(location) { var id = util.uuid(); if (validateLatLng(location.latitude, location.longitude)) { geocodeWithCustomIcon(location.getLatitudeLongitudeObject(), id, 'mcenter'); } else { geocodeWithCustomIcon(location.getLocationObject(), id, 'mcenter'); } addLocationToList(location, id); $('.directions-well').hide(); $('.location-well').hide(); } function addLocation() { clearAlerts(); if (validateLocationForm('location')) { var location = createLocationFromForm('location'); geocode(location); } } function removeLocation(id) { markerManager.removeMarker(id); $('#edit-button-' + id).hide(); $('#' + id).remove(); $('.edit-well').hide(); doPrint(); } function removeDirections(id) { $('.edit-well').hide(); directionsManager.removeDirections(id); $('#' + id).remove(); doPrint(); } function updateMarker(id) { var marker = markerManager.getMarker(id); markerManager.removeMarker(marker.id); var updatedIcon = updateIcon(id); var popup = L.marker(marker.latlng, { icon: updatedIcon.createLeafletIcon(), draggable: true }); popup.on('dragend', function(event) { markerManager.removeMarker(id); var aMarker = event.target; var position = aMarker.getLatLng().wrap(); markerManager.addMarker({ id: id, latlng: position, marker: aMarker, iconObject: updatedIcon, }); $('#' + id).children('.location').text(position.lat.toFixed(5) + ', ' + position.lng.toFixed(5)); doPrint(); }); markerManager.addMarker({ id: id, latlng: marker.latlng, marker: popup, iconObject: updatedIcon, }); $('.edit-well').hide(); doPrint(); } function directionsGeocode(location, iconName) { var id = util.uuid(); if (validateLatLng(location.latitude, location.longitude)) { geocodeWithCustomIcon(location.getLatitudeLongitudeObject(), id, iconName); } else { geocodeWithCustomIcon(location.getLocationObject(), id, iconName); } $('.directions-well').hide(); return id; } function generateRoute() { clearAlerts(); var id = util.uuid(); var startingLocation = null; var endingLocation = null; if (validateLocationForm('start')) { startingLocation = getStartingLocation(); } if (validateLocationForm('end')) { endingLocation = getEndingLocation(); } if (startingLocation !== null && endingLocation !== null) { var startingLocationId = directionsGeocode(startingLocation, 'scenter'); var endingLocationId = directionsGeocode(endingLocation, 'ecenter'); directionsManager.addDirections({ id: id, startingLocation: { id: startingLocationId, location: startingLocation, }, endingLocation: { id: endingLocationId, location: endingLocation, }, }); $('.directions-well').hide(); $('.location-well').hide(); } } function validateKey(keyObj) { $('#mapquest-key-container').removeClass('has-error'); $('#mapquest-key-container p').remove(); //check valid key if (isValidKey(keyObj)) { var thisKey = keyObj.value; thisKey = thisKey.trim(); if (!thisKey.match('[a-zA-Z]+')) { // alerting user $('#mapquest-key-container').addClass('has-error'); $('#mapquest-key-container').append('

Invalid key " + thisKey + ". Please enter a valid key.

'); return; } doPrint(); } } //validates the width of Static Map image. //Validation is true only if the width isNumber and inRange 1-2048 function validateWidth() { $('#map-width-container').removeClass('has-error'); $('#map-width-container p').remove(); var widthObj = document.getElementById('map-width'); var smWidth = widthObj.value; if (isNaN(smWidth)) { $('#map-width-container').addClass('has-error'); $('#map-width-container').append('

Please enter a valid number for width.

'); widthObj.value = 600; //set the default width } else { if (smWidth > 0 && smWidth < 2049) { var decPtIndex = smWidth.indexOf('.'); if (decPtIndex !== -1) { $('#map-width-container').addClass('has-error'); $('#map-width-container').append('

Value for width cannot be fractional.

'); widthObj.value = 600; //set the default width } } else { $('#map-width-container').addClass('has-error'); $('#map-width-container').append('

Invalid value for width. Acceptable range of width is 1-2048 px.

'); widthObj.value = 600; //set the default width } } doPrint(); } //validates the height of Static Map image. //Validation is true only if the height isNumber and inRange 1-2048 function validateHeight() { $('#map-height-container').removeClass('has-error'); $('#map-height-container p').remove(); var heightObj = document.getElementById('map-height'); var smHeight = heightObj.value; if (isNaN(smHeight)) { $('#map-height-container').addClass('has-error'); $('#map-height-container').append('

Please enter a valid number for height.

'); heightObj.value = 500; //set the default value } else { if (smHeight > 0 && smHeight < 2049) { var decPtIndex = smHeight.indexOf('.'); if (decPtIndex !== -1) { $('#map-height-container').addClass('has-error'); $('#map-height-container').append('

Value for width cannot be fractional.

'); heightObj.value = 500; //set the default value } } else { $('#map-height-container').addClass('has-error'); $('#map-height-container').append('

Invalid value for height. Acceptable range of height is 1-2048 px.

'); heightObj.value = 500; //set the default value } } doPrint(); } function jumpToTop() { $('html, body').animate({ scrollTop: $('body').offset().top + 20, }, 0); } //Keep track of the active layer on the leaflet map map.on('baselayerchange', function(e) { if (e.name === 'Map') { activeLayer = 'map'; } if (e.name === 'Hybrid') { activeLayer = 'hyb'; } if (e.name === 'Satellite') { activeLayer = 'sat'; } doPrint(); }); map.on('zoomend', function() { doPrint(); }); map.on('dragend', function() { doPrint(); }); $('#toggle-location-btn').click(function() { document.getElementById('location-form').reset(); $('.location-well').show(); $('.directions-well').hide(); $('#location-address').focus(); }); $('#directions-well-close').click(function() { $('.directions-well').hide(); }); $('#jump-to-static-map').click(function() { $('html, body').animate({ scrollTop: $('#staticMapWindow').offset().top - 80, }, 0); }); $('#location-well-close').click(function() { $('.location-well').hide(); }); $('#edit-well-close').click(function() { $('.edit-well').hide(); }); $('#toggle-directions-btn').click(function() { document.getElementById('directions-form').reset(); $('.directions-well').show(); $('.location-well').hide(); $('#start-address').focus(); });