summaryrefslogtreecommitdiff
path: root/static
diff options
context:
space:
mode:
Diffstat (limited to 'static')
-rw-r--r--static/js/bundle.js66
1 files changed, 38 insertions, 28 deletions
diff --git a/static/js/bundle.js b/static/js/bundle.js
index b574bdb..7eb9497 100644
--- a/static/js/bundle.js
+++ b/static/js/bundle.js
@@ -81,8 +81,43 @@
key: 'componentDidMount',
// mapbox auth token
value: function componentDidMount() {
+ var _this2 = this;
+
mapboxgl.accessToken = this.props.token;
+
this.map = new mapboxgl.Map(this.props.view);
+ this.map.on('style.load', function () {
+ _this2.map.addSource('radar-140', {
+ "type": "image",
+ "url": "/static/img/20160101_103000_140.png",
+ "coordinates": [[33.35317413, 33.27232471], [36.32243686, 33.27232471], [36.32243686, 30.72293428], [33.35317413, 30.72293428]]
+ });
+ _this2.map.addSource('radar-280', {
+ "type": "image",
+ "url": "/static/img/20160101_103000_280.png",
+ "coordinates": [[31.93095218, 34.5156862], [37.86644267, 34.5156862], [37.86644267, 29.42911589], [31.93095218, 29.42911589]]
+ });
+
+ _this2.map.addLayer({
+ "id": "radar-140",
+ "source": "radar-140",
+ "type": "raster",
+ "paint": {
+ "raster-opacity": 0.85
+ },
+ "layout": {
+ "visibility": "none"
+ }
+ });
+ _this2.map.addLayer({
+ "id": "radar-280",
+ "source": "radar-280",
+ "type": "raster",
+ "paint": {
+ "raster-opacity": 0.85
+ }
+ });
+ });
}
// Adapted from Tim Welch's code that can be found at
@@ -126,16 +161,6 @@
"mapbox": {
"type": "vector",
"url": "mapbox://mapbox.mapbox-streets-v6"
- },
- "radar_140": {
- "type": "image",
- "url": "/static/{{ latest_140 }}_140.png",
- "coordinates": [[33.35317413, 33.27232471], [36.32243686, 33.27232471], [36.32243686, 30.72293428], [33.35317413, 30.72293428]]
- },
- "radar_280": {
- "type": "image",
- "url": "/static/{{ latest_280 }}_280.png",
- "coordinates": [[31.93095218, 34.5156862], [37.86644267, 34.5156862], [37.86644267, 29.42911589], [31.93095218, 29.42911589]]
}
},
"sprite": "mapbox://sprites/mapbox/dark-v8",
@@ -164,23 +189,6 @@
"type": "fill",
"paint": { "fill-color": "#111122" }
}, {
- "id": "radar_140",
- "source": "radar_140",
- "type": "raster",
- "paint": {
- "raster-opacity": 0.85
- },
- "layout": {
- "visibility": "none"
- }
- }, {
- "id": "radar_280",
- "source": "radar_280",
- "type": "raster",
- "paint": {
- "raster-opacity": 0.85
- }
- }, {
"id": "cities",
"source": "mapbox",
"source-layer": "place_label",
@@ -226,7 +234,9 @@
style: mapStyle,
hash: false
};
- return _react2.default.createElement(GLMap, { view: view, token: 'pk.eyJ1IjoieXV2YWRtIiwiYSI6ImNpaWRuaWFxazAwMTJ2b2tyZGRmaWpsNWYifQ.qf_V3CFP_NZtLjk5luNM4g' });
+ return _react2.default.createElement(GLMap, {
+ view: view,
+ token: 'pk.eyJ1IjoieXV2YWRtIiwiYSI6ImNpaWRuaWFxazAwMTJ2b2tyZGRmaWpsNWYifQ.qf_V3CFP_NZtLjk5luNM4g' });
}
}]);