Spanish public mapping services for Leaflet: add IGN basemaps, PNOA imagery, administrative boundaries and thematic WMS/WMTS layers with a provider name.
Explore layers · Open the map · Usage guide (ES)
The plugin works directly with Leaflet. You can also combine it with leaflet-providers on the same map.
Load the Leaflet CSS and JavaScript first, then load leaflet-providersESP. You can optionally load leaflet-providers.
Use the published v1.5.0 release with Leaflet 1.9.4.
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/leaflet@1.9.4/dist/leaflet.css">
<script src="https://cdn.jsdelivr.net/npm/leaflet@1.9.4/dist/leaflet.js"></script>
<script src="https://cdn.jsdelivr.net/gh/dieghernan/leaflet-providersESP@v1.5.0/dist/leaflet-providersESP.min.js"></script>To follow development on main, replace only the plugin script with this URL:
<script src="https://cdn.jsdelivr.net/gh/dieghernan/leaflet-providersESP@main/dist/leaflet-providersESP.min.js"></script>The main URL follows that branch and may change. Changes in this checkout
can be tested with the local files below.
Copy dist/leaflet-providersESP.min.js next to your HTML file and replace the
plugin script in the complete example below with:
<script src="./leaflet-providersESP.min.js"></script>You can also copy dist/leaflet-providersESP.js and use
src="./leaflet-providersESP.js" for the readable source. Both files are in
dist/. Keep the Leaflet CSS and JavaScript includes before the plugin.
Save this complete example as index.html and open it in a browser. The map
container needs an explicit height to be visible.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Map of Spain</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/leaflet@1.9.4/dist/leaflet.css">
<script src="https://cdn.jsdelivr.net/npm/leaflet@1.9.4/dist/leaflet.js"></script>
<script src="https://cdn.jsdelivr.net/gh/dieghernan/leaflet-providersESP@v1.5.0/dist/leaflet-providersESP.min.js"></script>
<style>
html, body { height: 100%; margin: 0; }
#map { height: 100%; width: 100%; }
</style>
</head>
<body>
<div id="map"></div>
<script>
var map = L.map('map').setView([40.4166, -3.7038], 12);
L.tileLayer.providerESP('IGNBase.Todo').addTo(map);
</script>
</body>
</html>Use Provider.Variant to select a layer. Omitting the variant selects the
provider's default: IGNBase and IGNBase.Todo display the same cartography.
Each call creates a separate Leaflet layer.
var map = L.map('map').setView([40.4166, -3.7038], 12);
var base = L.tileLayer.providerESP('IGNBase.Gris').addTo(map);
var boundaries = L.tileLayer.providerESP('UnidadesAdm.Limites', {
opacity: 0.7
}).addTo(map);
L.control.layers({ 'IGN gray': base }, { Boundaries: boundaries }).addTo(map);The catalog lets you compare layer previews and copy code with or without the plugin. The map viewer lets you add basemaps and overlays to the standard Leaflet layer control and choose which ones to display. An optional location button centers the map on your position. Documentation and map controls are in Spanish. The layer reference describes every layer, including coverage, scale and availability limitations.
Coverage, zoom limits, availability and terms of use depend on each service. Keep the Leaflet attribution control visible and check the provider's terms before reusing its maps. The MIT license covers this plugin's code.
See the changelog for aliases, deprecated layers and known
issues, including Copernicus.RiparianGreen. The
service audit records dated checks; inclusion in the
catalog does not guarantee that a remote service is currently available.
After each successful deployment, the Send outgoing Webmentions workflow
checks external links in published page content and sends mentions to
destinations that advertise a compatible endpoint. It uses the HTML built from
docs/ and stores delivery state in the webmention-state branch to avoid
repeated submissions while the content is unchanged. Failed requests are retried
on later runs. The workflow can also be run manually from GitHub Actions.
See CONTRIBUTING.md for development commands, tests and how to report broken services or propose a provider.
MIT. This project builds on the provider configuration approach of leaflet-providers.
