Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <!DOCTYPE html>
<html lang="en" >
      <meta charset="UTF-8">
      <title>Drawing isochrones</title>
      <!DOCTYPE html>
         <meta name="description" content="Class 10 Show+Tell: GeoJson">
         <meta charset="utf-8">
         <meta name="viewport" content="width=device-width">
          <link rel="stylesheet" href=""
                     <script src=""
               html, body, #mapid { 
               height: 100%;
               width: 100%;
               padding: 0;
               margin: 0;
               #error {
                  position: absolute;
                  width: 80%;
                  margin: 0px;
                  z-index: 2000;
                  width: 80%;
                  border-radius: 20px;
                  max-width: 500px;
                  top: 30%;  /* position the top  edge of the element at the middle of the parent */
                  left: 50%; /* position the left edge of the element at the middle of the parent */
                  transform: translate(-50%, -50%);
                  background-color: white;
                  padding: 10px;
                  display: none;
                  text-align: center;
            <script src=""
            <div id="mapid"></div>
      <div id="error" class="tippy-tooltip honeybee-theme">
         <p><b>No API and APPLICATION_ID key inserted </b></p>
         <p><a href="">Sign up for an API key</a> 
         <p>Place it in API and APPLICATION_ID variables</p>
         // The name of the starting location. We will have to geocode this to coordinates.
         var startingLocation = "The White House, DC";
         // The departure time in an ISO format.
         var departureTime =  new Date().toJSON();
         // Travel time in seconds. We want 1 hour travel time so it is 60 minutes x 60 seconds.
         var travelTime = 60 * 20;
         // These secret variables are needed to authenticate the request. Get them from and replace 
         var APPLICATION_ID = "place your app id here";
         var API_KEY = "place your api key here";
         var mymap ='mapid').setView([38.8, -77.0365], 9);
         	L.tileLayer(`{z}/{x}/{y}.png?key=${APPLICATION_ID}`, {
         		maxZoom: 18,
         		attribution: 'Map data &copy; <a href="">OpenStreetMap</a> contributors, ' +
         			'<a href="">CC-BY-SA</a>, ' +
         			'Imagery © <a href="">Mapbox</a>',
         		id: 'mapbox.streets'
         // Sends the geocoding request.
         function sendGeocodingRequest(location) {
           // The request for the geocoder. Reference:
           var request = {
             query: location };
           document.getElementById("error").style.display = "none";
           var xhr = new XMLHttpRequest();
           xhr.responseType = "json";
 "GET", ""+ location)
           xhr.setRequestHeader( "X-Application-Id", APPLICATION_ID);
           xhr.setRequestHeader( "X-Api-Key", API_KEY);
           xhr.setRequestHeader( "Accept-Language", " en-US");
           xhr.onreadystatechange = function () {
              if (xhr.status >= 200 && xhr.status < 300) {
                if(xhr.readyState === 4){
              } else {
                if(APPLICATION_ID === "place your app id here" || API_KEY ===  "place your api key here") {
                  document.getElementById("error").style.display = "block";
         // Sends the request of the Time Map multipolygon.
         function sendTimeMapRequest(geocodingResponse) {
           // The request for Time Map. Reference:
           var coords = geocodingResponse.features[0].geometry.coordinates;
           var latLng = { lat: coords[1], lng: coords[0] };
           var request = {
             departure_searches: [{
               id: "first_location",
               coords: latLng,
               transportation: {
                 type: "public_transport" },
               departure_time: departureTime,
               travel_time: travelTime }],
             arrival_searches: [] };
          var xhr = new XMLHttpRequest()
          xhr.addEventListener("readystatechange", function () {
            if (this.readyState === 4) {
              drawTimeMap(mymap, this.response);
"POST", "")
          xhr.setRequestHeader("X-Application-Id", APPLICATION_ID);
          xhr.setRequestHeader("X-Api-Key", API_KEY);
          xhr.setRequestHeader("Content-Type", "application/json; charset=UTF-8");
          xhr.responseType = "json";
         // A helper function that converts [{lat: <lat>, lng: <lng>}, ...] to a [[<lat>, <lng>], ...] format.
         function ringCoordsHashToArray(ring) {
           return (latLng) {return [, latLng.lng];});
         // Draws the resulting multipolygon from the response on the map.
         function drawTimeMap(map, response) {
             // Reference for the response:
             var shapesCoords = response.results[0] (polygon) {
               var shell = ringCoordsHashToArray(;
               var holes =;
               return [shell].concat(holes);
             var polygon = L.polygon(shapesCoords, { color: 'red' });