MapQuest.com
Business
Navigation
Getting Started
Developer Blog
Web SDKs
MapQuest.js
PlaceSearch.js
APIs
Data Manager API
Directions API
Geocoding API
Icons API
Search API
Place Search API
Search Ahead API
Static Map API
Traffic API
Legacy Products
Leaflet Plugins
Maps
Geocoding
Routing
Traffic
API Reference
Tools
Lat/Lng Finder
Link to MapQuest
Share
Getting Started
Developer Blog
Documentation
Web SDKs
MapQuest.js
PlaceSearch.js
new
APIs
Data Manager API
Directions API
Geocoding API
Icons API
Search API
Place Search API
Search Ahead API
Static Map API
Traffic API
Legacy Products
Leaflet Plugins
Maps
Geocoding
Routing
Traffic
API Reference
Tools
Lat/Lng Finder
Link to MapQuest
Share
Route Customization with Clickable POI's
Edit the code below and click "Try It Now" to display the result.
<html> <head> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/leaflet.css" /> <script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/leaflet.js"></script> <script src="https://www.mapquestapi.com/sdk/leaflet/v2.2/mq-map.js?key=ck2OXUAJsF0iz999XGQ62jyXo8AXOVp7"></script> <script src="https://www.mapquestapi.com/sdk/leaflet/v2.2/mq-routing.js?key=ck2OXUAJsF0iz999XGQ62jyXo8AXOVp7"></script> <script type="text/javascript"> window.onload = function() { var map, dir; map = L.map('map', { layers: MQ.mapLayer(), center: [ 40.045049, -105.961737 ], zoom: 9 }); dir = MQ.routing.directions(); dir.route({ locations: [ '80217', 'steamboat springs co' ], options: { avoids: ['toll road'] } }); CustomRouteLayer = MQ.Routing.RouteLayer.extend({ createStopMarker: function(location, stopNumber) { var custom_icon, marker; custom_icon = L.icon({ iconUrl: 'https://www.mapquestapi.com/staticmap/geticon?uri=poi-red_1.png', iconSize: [20, 29], iconAnchor: [10, 29], popupAnchor: [0, -29] }); marker = L.marker(location.latLng, { icon: custom_icon, draggable: this.options.draggable }) .bindPopup(location.adminArea5 + ' ' + location.adminArea3) .openPopup() .addTo(map); return marker; } }); map.addLayer(new CustomRouteLayer({ directions: dir, fitBounds: true, draggable: false, ribbonOptions: { ribbonDisplay: { color: '#CC0000', opacity: 0.3 }, widths: [ 15, 15, 15, 15, 14, 13, 12, 12, 12, 11, 11, 11, 11, 12, 13, 14, 15 ] } })); } </script> </head> <body style='border:0; margin: 0'> <div id='map' style='width: 100%; height:530px;'></div> </body> </html>
Try It Now
Try It Nows
Maps
Basic Map
Map with Geolocation
Map with Layers
Geocoding
Use Advanced Location
Batch Geocoding
POI Popup
Popup
Custom Icons
Reverse Geocoding
Use Single-Line Addresses
Routing
Use Advanced Location
Alternate Routes
Custom Start & End Markers
Customization
Multiple Locations
Narratives
Optimized Routing
Options
Use Single-Line Addresses
Traffic
Traffic Map
Traffic with Layers
Open
Open Maps
Open Geocoding
Open Routing