Difference between revisions of "Range layers"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
− | |||
<html> | <html> | ||
<head> | <head> | ||
Line 13: | Line 12: | ||
max-height: 100%; | max-height: 100%; | ||
} | } | ||
− | + | </style> | |
</head> | </head> | ||
<body> | <body> | ||
<div id="map" style="width: 100%; height: 500px;"></div> | <div id="map" style="width: 100%; height: 500px;"></div> | ||
+ | |||
<script> | <script> | ||
+ | // GEOJSON FILES | ||
+ | var hoolockhoolock = 'files/gibbon/Hoolock_hoolock.geojson'; | ||
+ | var hoolockleuconedys = 'files/gibbon/Hoolock_leuconedys.geojson'; | ||
+ | var hoolocktianxing = 'files/gibbon/Hoolock_tianxing.geojson'; | ||
+ | var Nomascus_hainanus = 'files/gibbon/Nomascus_hainanus.geojson'; | ||
+ | var hyloabbotti = 'files/gibbon/Hylobates_abbotti.geojson'; | ||
− | + | // Create map | |
− | + | var map = L.map('map').setView([10, 110], 4); | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | // Create open maps | |
− | + | var osm=new L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png',{attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'}).addTo(map); | |
− | + | var topo=new L.tileLayer('http://{s}.tile.opentopomap.org/{z}/{x}/{y}.png',{attribution: '© <a href="http://osm.org/copyright">OpenTopoMap</a> contributors'}).addTo(map); | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | // POPUP | |
− | + | function forEachFeature(feature, layer) { var popupContent = "<p><b>Species: </b>"+ feature.properties.BINOMIAL +'</p>'; layer.bindPopup(popupContent);} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | // Set style function that sets fill color property | |
− | + | function stylehoolockhoolock(feature) { return { fillColor: '#F31818', fillOpacity: 0.7, weight: 2, opacity: 0.7, color: '#F31818', dashArray: '3' }; } | |
− | + | function stylehoolockleuconedys(feature) { return { fillColor: '#AF1818', fillOpacity: 0.7, weight: 2, opacity: 0.7, color: '#AF1818', dashArray: '3' };} | |
+ | function stylehoolocktianxing(feature) { return { fillColor: '#B65757', fillOpacity: 0.7, weight: 2, opacity: 0.7, color: '#B65757', dashArray: '3' }; } | ||
+ | function stylehyloabbotti(feature) { return { fillColor: '#F87446', fillOpacity: 0.7, weight: 2, opacity: 0.7, color: '#F87446', dashArray: '3' }; } | ||
+ | function styleNomascus_hainanus(feature) {return { fillColor: 'blue',fillOpacity: 0.7,weight: 2,opacity: 0.7,color: 'blue',dashArray: '3', }; } | ||
− | + | // Null variable that will hold layer | |
− | + | var hoolockhoolockLayer = L.geoJson(null, {onEachFeature: forEachFeature, style: stylehoolockhoolock}); | |
− | + | var hoolockleuconedysLayer = L.geoJson(null, {onEachFeature: forEachFeature, style: stylehoolockleuconedys}); | |
− | + | var hoolocktianxingLayer = L.geoJson(null, {onEachFeature: forEachFeature,style: stylehoolocktianxing}); | |
− | + | var hyloabbottiLayer = L.geoJson(null, {onEachFeature: forEachFeature,style: stylehyloabbotti}); | |
+ | var Nomascus_hainanusLayer = L.geoJson(null, {onEachFeature: forEachFeature, style: styleNomascus_hainanus}); | ||
− | + | $.getJSON(hoolockhoolock, function(data) { hoolockhoolockLayer.addData(data);}); hoolockhoolockLayer.addTo(map); | |
− | + | $.getJSON(hoolockleuconedys, function(data) { hoolockleuconedysLayer.addData(data);}); hoolockleuconedysLayer.addTo(map); | |
− | + | $.getJSON(hoolocktianxing, function(data) { hoolocktianxingLayer.addData(data);}); hoolocktianxingLayer.addTo(map); | |
− | + | $.getJSON(hyloabbotti, function(data) { hyloabbottiLayer.addData(data);}); hyloabbottiLayer.addTo(map); | |
− | + | $.getJSON(Nomascus_hainanus, function(data) { Nomascus_hainanusLayer.addData(data);}); Nomascus_hainanusLayer.addTo(map); | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | // for Layer Control | |
− | + | var baseMaps = { | |
+ | "Open Street Map": osm, | ||
+ | "Open Topo Map": topo, | ||
+ | }; | ||
+ | |||
+ | var overlayMaps = { | ||
+ | "Hoolock hoolock range": hoolockhoolockLayer, | ||
+ | "Hoolock leuconedys range": hoolockleuconedysLayer, | ||
+ | "Hoolock tianxing": hoolocktianxingLayer, | ||
+ | "Hylobates abbotti": hyloabbottiLayer, | ||
+ | "Nomascus hainanus range": Nomascus_hainanusLayer, | ||
+ | }; | ||
+ | |||
+ | //Add layer control | ||
+ | L.control.layers(baseMaps, overlayMaps).addTo(map); | ||
</script> | </script> | ||
</body> | </body> | ||
</html> | </html> | ||
+ | |||
{|border="1" cellpadding="5" cellspacing="0" <!-- align="right" --> class="gibbon_ranges" !style="background-color:#ccffcc;" | {|border="1" cellpadding="5" cellspacing="0" <!-- align="right" --> class="gibbon_ranges" !style="background-color:#ccffcc;" | ||
− | |+'''Download available layers | + | |+'''Download available layers''' |
!Species | !Species | ||
!Shapefile | !Shapefile | ||
!GeoJSON | !GeoJSON | ||
+ | !Source | ||
|- | |- | ||
|Hoolock hoolock | |Hoolock hoolock | ||
|[https://iucnapesportal.org/wiki/files/Hoolock_hoolock.zip ''Hoolock hoolock shapefile''] (ZIP; 110 kB)] | |[https://iucnapesportal.org/wiki/files/Hoolock_hoolock.zip ''Hoolock hoolock shapefile''] (ZIP; 110 kB)] | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
| | | | ||
| | | | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|} | |} |
Revision as of 10:41, 7 March 2022
Species | Shapefile | GeoJSON | Source |
---|---|---|---|
Hoolock hoolock | Hoolock hoolock shapefile (ZIP; 110 kB)] |