Last active
May 4, 2016 05:36
-
-
Save Kalimaha/c5eb9b688461789ba107de6a8077c80d to your computer and use it in GitHub Desktop.
Leaflet Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script type="application/javascript"> | |
| /* Load GeoJSON file. */ | |
| $.getJSON('geojson/1859.geojson', function (result) { | |
| /* Init variables. */ | |
| var geojson = result, | |
| map_1859 = L.map('1859').setView([42.10, 12.50], 5), | |
| opacity = 1.0; | |
| /* Add base layer. */ | |
| L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}', { | |
| maxZoom: 18, | |
| id: 'MY_MAPBOX_ID', | |
| accessToken: 'MY_MAPBOX_ACCESS_TOKEN' | |
| }).addTo(map_1859); | |
| /* Add GeoJSON to the map. */ | |
| L.geoJson(geojson, { | |
| /* Polygons border's width. */ | |
| weight: 1, | |
| /* Polygons border's color. */ | |
| color: '#555555', | |
| /* Polygons color. */ | |
| style: function (feature) { | |
| switch (feature.properties.STATO) { | |
| case 'Ducato di Parma': return {fillColor: "#D65076", fillOpacity: opacity}; | |
| ... | |
| case 'Regno delle Due Sicilie': return {fillColor: "#BC243C", fillOpacity: opacity}; | |
| } | |
| } | |
| }).addTo(map_1859); | |
| /* Synchronize the maps. */ | |
| sync_map(map_1859); | |
| }); | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment