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.


Save Automatically?

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">
    <title>Geocoding for Leaflet</title>
    <!DOCTYPE html>
        <link rel="stylesheet" href="" />
        <link rel="stylesheet" href="css.css" />
        <script src="[email protected]/dist/leaflet.js" integrity="sha512-QVftwZFqvtRNi0ZyCtsznlKSWOStnDORoefr1enyq5mVL4tmKB3S/EnC3rRJcxCPavG10IcrVGSmPh6Qw5lwrg==" crossorigin=""></script>

    <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 target="_blank" href="">Sign up for an API key</a>
            <p>Place it in API and APPLICATION_ID variables</p>
        var locationName = "Tour Eiffel, Paris, France";
        // 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";

        ///sending request    
            .then(function(data) {
                //and if it is success drawing map and marker
            .catch(function(error) {
                if(APPLICATION_ID === "place your app id here" || API_KEY ===  "place your api key here") {
                  document.getElementById("error").style.display = "block";

        function drawMarker(response) {  // We need to extract the coordinates from the response.
            var coordinates = response.features[0].geometry.coordinates;  // The coordintaes are in a [<lng>, <lat>] format/
            var latLng = L.latLng([coordinates[1], coordinates[0]])  // The url template for OpenStreetMap tiles.
            var osmUrl = "http://{s}{z}/{x}/{y}.png";     // Creates the tile layer.
            var osmTileLayer = L.tileLayer(osmUrl, {
                minZoom: 8,
                maxZoom: 15
            });  // Adds the tile layer to the map.
            var map ="mapid").addLayer(osmTileLayer); 
            map.setView(latLng, 11);  // Creates a marker for our departure location and adds it to the map.
            var markter = L.marker(latLng).addTo(map);

        function sendGeocodingRequest(location) {
            return fetch(`` + location, {
                    method: "GET",
                    credentials: "same-origin", 
                    headers: {
                        "Content-Type": "application/json",
                        "X-Application-Id": APPLICATION_ID,
                        "X-Api-Key": API_KEY,
                        "Accept-Language": "en-US"

                .then(response => response.json()); // parses JSON response into native Javascript objects 
        #mapid {
            height: 100%;
            width: 100%;
            padding: 0;
            margin: 0;
        #error {
            position: absolute;
            width: 80%;
            margin: 0px;
            z-index: 2000;
            width: 270px;
            border-radius: 5px;
            max-width: 500px;
            font-family: sans-serif;
            font-size: 12px;
            top: 30%;
            left: 50%;
            transform: translate(-50%, -50%);
            background-color: white;
            padding: 10px;
            display: none;
            text-align: center;