Sha256: 88f162e2d466998c35ecdcebe2700b3ccbebbee8508aaf681f2ac7600deb5d13
Contents?: true
Size: 1.87 KB
Versions: 2
Compression:
Stored size: 1.87 KB
Contents
//= require geoblacklight/viewers/map GeoBlacklight.Viewer.IndexMap = GeoBlacklight.Viewer.Map.extend({ load: function() { this.map = L.map(this.element).fitBounds(this.options.bbox); this.map.addLayer(this.selectBasemap()); if (this.data.available) { this.addPreviewLayer(); } else { this.addBoundsOverlay(this.options.bbox); } }, availabilityStyle: function(availability) { var style = { radius: 4, weight: 1, } // Style the colors based on availability if (typeof(availability) === 'undefined') { return style; // default Leaflet style colorings } if (availability) { style.color = '#1eb300'; } else { style.color = '#b3001e'; } return style }, addPreviewLayer: function() { var _this = this; var geoJSONLayer; $.getJSON(this.data.url, function(data) { geoJSONLayer = L.geoJson(data, { style: function(feature) { return _this.availabilityStyle(feature.properties.available); }, onEachFeature: function(feature, layer) { // Add a hover label for the label property if (feature.properties.label !== null) { layer.bindTooltip(feature.properties.label); } // If it is available add clickable info if (feature.properties.available !== null) { layer.on('click', function(e) { GeoBlacklight.Util.indexMapTemplate(feature.properties, function(html) { $('.viewer-information').html(html); }); }); } }, // For point index maps, use circle markers pointToLayer: function (feature, latlng) { return L.circleMarker(latlng); } }).addTo(_this.map); _this.map.fitBounds(geoJSONLayer.getBounds()); }); } });
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
geoblacklight-1.9.1 | app/assets/javascripts/geoblacklight/viewers/index_map.js |
geoblacklight-1.9.0 | app/assets/javascripts/geoblacklight/viewers/index_map.js |