Last active
November 2, 2016 17:42
-
-
Save okjodom/438d8ddf2476aaa1553f6d018279fd20 to your computer and use it in GitHub Desktop.
Bootleaf layer loader
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
| /* Empty layer placeholder to add to layer control for listening when to add/remove theaters to markerClusters layer */ | |
| var tweetLayer = L.geoJson(null); | |
| var tweets = L.geoJson(null, { | |
| pointToLayer: function (feature, latlng) { | |
| return L.marker(latlng, { | |
| icon: L.icon({ | |
| iconUrl: "assets/img/tweet.png", | |
| iconSize: [24, 28], | |
| iconAnchor: [12, 28], | |
| popupAnchor: [0, -25] | |
| }), | |
| title: feature.properties.text.substr(10), | |
| riseOnHover: true | |
| }); | |
| }, | |
| onEachFeature: function (feature, layer) { | |
| if (feature.properties) { | |
| var content = "<table class='table table-striped table-bordered table-condensed'>" + "<tr><th>TEXT</th><td>" + feature.properties.text + "</td></tr>" + "<tr><th>DATE</th><td>" + feature.properties.created_at + "</td></tr>" + "<table>"; | |
| layer.on({ | |
| click: function (e) { | |
| $("#feature-title").html(feature.properties.text.substr(10)); | |
| $("#feature-info").html(content); | |
| $("#featureModal").modal("show"); | |
| highlight.clearLayers().addLayer(L.circleMarker([feature.geometry.coordinates[1], feature.geometry.coordinates[0]], highlightStyle)); | |
| } | |
| }); | |
| $("#feature-list tbody").append('<tr class="feature-row" id="' + L.stamp(layer) + '" lat="' + layer.getLatLng().lat + '" lng="' + layer.getLatLng().lng + '"><td style="vertical-align: middle;"><img width="16" height="18" src="assets/img/tweet.png"></td><td class="feature-name">' + layer.feature.properties.text.substr(10) + '</td><td style="vertical-align: middle;"><i class="fa fa-chevron-right pull-right"></i></td></tr>'); | |
| tweetSearch.push({ | |
| name: layer.feature.properties.text.substr(10), | |
| // address: layer.feature.properties.ADDRESS1, | |
| source: "Tweets", | |
| // id: L.stamp(layer), | |
| // date: layer.feature.properties.created_at, | |
| lat: layer.feature.geometry.coordinates[1], | |
| lng: layer.feature.geometry.coordinates[0] | |
| }); | |
| } | |
| } | |
| }); | |
| $.getJSON("data/sample_data.geojson", function (data) { | |
| theaters.addData(data); | |
| map.addLayer(tweetLayer); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment