Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

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

Packages

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.

Behavior

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.

HTML

              
                <header>
  <link rel="stylesheet" href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css" />
  <script src="https://unpkg.com/leaflet@1.6.0/dist/leaflet.js">
  </script>
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
      <script src="https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.6.2/proj4.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/proj4leaflet/1.0.2/proj4leaflet.js"></script>
</header>
</header>

<body>
  <div class="container">
    <h2>Stadt- und Parzellenplan</h2>
    <div id="map"></div>
    This examples shows how to use tiles of the <a target="blank" href="https://www.geo.bs.ch" />geo.bs.ch </a> in leaflet using the Swiss CH1903+ / LV95 (<a target="blank" href="https://epsg.io/2056" target="_blank">EPSG:2056</a>).<br>
 <p>The map shows the orthofoto 2017 of the canton Basel-Stadt (<a target="blank" href="https://map.geo.bs.ch/?lang=de&baselayer_ref=Grundkarte%20grau&tree_enable_OF_Orthofoto2017Maerz=true&map_x=2611662&map_y=1267365&map_zoom=8&tree_groups=Luftbilder%2COrthofotos%2CSatellitenbilder&tree_group_layers_Luftbilder=&tree_enable_ch.swisstopo.swissimage-product=false&tree_enable_SB_SatellitenbilderBaselStadt201630=false&tree_enable_SB_SatellitenbilderBaselStadt201650=false&tree_enable_SB_SatellitenbilderBaselStadt201725=false&tree_enable_SB_SatellitenbilderBaselStadt201950=false">Orthofoto 2017 March</a>). </p>
    <p>The WMTS in EPSG 2056 is provided for the layers defined in the <a target="blank" href="https://wmts.geo.bs.ch/1.0.0/WMTSCapabilities.xml">WMTS Capabilities</a>.</p>
  </div>
</body>
              
            
!

CSS

              
                #map {
  height: 350px;
  width: 800px;
}

              
            
!

JS

              
                var lv95 = {
 epsg: 'EPSG:2056',
 def: '+proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 +k_0=1 +x_0=2600000 +y_0=1200000 +ellps=bessel +towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs',
 resolutions: [50,20,10,5,2.5,2,1.5,1,0.5,0.25,0.1,0.05,0.025,0.01],
 origin: [2550000,1315000]
}
var crs = new L.Proj.CRS(lv95.epsg, lv95.def, { 
 resolutions: lv95.resolutions, 
 origin: lv95.origin
})
var map = new L.Map('map', {
    crs: crs,
    maxZoom: crs.options.resolutions.length,
  });

L.tileLayer('https://wmts.geo.dev.bs.ch/wmts/1.0.0/OF_TrueOrthofoto2017Maerz/default/swissgrid/{z}/{y}/{x}.png', {
  maxZoom: crs.options.resolutions.length,
  //minZoom: 0,
  attribution:
    '<a href="https://www.geo.bs.ch/">Geoportal Kanton Basel-Stadt</a>',
  }).addTo(map);
map.setView(L.latLng(47.55856, 7.59142),4);

              
            
!
999px

Console