GithubHelp home page GithubHelp logo

gcebelieu / leaflet-providers Goto Github PK

View Code? Open in Web Editor NEW

This project forked from leaflet-extras/leaflet-providers

0.0 2.0 0.0 461 KB

An extension to Leaflet that contains configurations for various free tile providers.

Home Page: http://leaflet-extras.github.io/leaflet-providers/preview/

License: BSD 2-Clause "Simplified" License

CSS 11.09% HTML 22.29% JavaScript 66.63%

leaflet-providers's Introduction

Leaflet-providers

An extension to Leaflet that contains configurations for various free1 tile providers.

Installation

Download leaflet-providers.js and include it in your page after including Leaflet, e.g.:

<head>
  ...
  <script src="http://unpkg.com/[email protected]/dist/leaflet.js"></script>
  <script src="js/leaflet-providers.js"></script>
</head>

Usage

Leaflet-providers providers are refered to with a provider[.<variant>]-string. Let's say you want to add the nice Watercolor style from Stamen to your map, you pass Stamen.Watercolor to the L.tileLayer.provider-constructor, which will return a L.TileLayer instance for Stamens Watercolor tile layer.

// add Stamen Watercolor to map.
L.tileLayer.provider('Stamen.Watercolor').addTo(map);

Protocol relativity (https://-urls)

Leaflet-providers tries to use https:// if the page uses https:// and the provider supports it.

Providers

Leaflet-providers provides tile layers from different providers, including OpenStreetMap, Stamen, Esri and OpenWeatherMap. The full listing of free to use layers can be previewed. The page will show you the name to use with leaflet-providers.js and the code to use it without dependencies.

Providers requiring registration

In addition to the providers you are free1 to use, we support some layers which require registration.

HERE (formerly Nokia).

In order to use HERE layers, you must register. Once registered, you can create an app_id and app_code which you have to pass to L.tileLayer.provider in the options:

L.tileLayer.provider('HERE.terrainDay', {
    app_id: '<insert ID here>',
    app_code: '<insert ID here>'
}).addTo(map);

Available HERE layers

Mapbox

In order to use Mapbox maps, you must register. You can get map_ID (i.e mapbox.satellite) and ACCESS_TOKEN from Mapbox projects:

L.tileLayer.provider('MapBox', {
    id: 'ID': '<insert map_ID here>',
    accessToken: '<insert ACCESS_TOKEN here>'
}).addTo(map);

Thunderforest

In order to use Thunderforest maps, you must register. Once registered, you have an api_key which you have to pass to L.tileLayer.provider in the options:

L.tileLayer.provider('Thunderforest.Landscape', {apikey: '<insert api_key here>'}).addTo(map);

Esri/ArcGIS

In order to use ArcGIS maps, you must register and abide by the terms of service. No special syntax is required.

Available Esri layers

Attribution

This work was inspired from https://gist.github.com/1804938, and originally created by Stefan Seelmann.

What do we mean by free?

1 We try to maintain leaflet-providers in such a way that you'll be able to use the layers we include without paying money. This doesn't mean no limits apply, you should always check before using these layers for anything serious.

leaflet-providers's People

Contributors

jieter avatar brunob avatar ximex avatar seelmann avatar stevenheinrich avatar tomhughes avatar duncmc avatar dpix avatar calvinmetcalf avatar gutenye avatar chatelao avatar stefanocudini avatar voda avatar mcguffin avatar zerocrates avatar abierbaum avatar pensierinmusica avatar almccon avatar vincent3569 avatar tmcw avatar stephan-nordnes-eriksen avatar wanztwurst avatar routexl avatar missinglink avatar petertheone avatar peterdavehello avatar patrickarlt avatar maxdeepfield avatar kartenkarsten avatar cyrille37 avatar

Watchers

James Cloos avatar Gilles Cébélieu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.