Skip to content

Commit

Permalink
Remove jQuery in example8. Update baselayer
Browse files Browse the repository at this point in the history
  • Loading branch information
Biel Frontera committed Oct 13, 2017
1 parent dd45595 commit b87b3dc
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
Binary file modified examples/img/screenshot/8-hfradar-with-drifters.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/img/screenshot/screenshot-leaflet-timedimension.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 20 additions & 6 deletions examples/js/example8.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,16 @@ L.TimeDimension.Layer.DrifterDeployment = L.TimeDimension.Layer.GeoJson.extend({
var url = "http://apps.socib.es/DataDiscovery/deployment-info?" +
"id_platform=" + this._id_platform + "&id_deployment=" + this._id_deployment +
"&sample=50";
$.getJSON(proxy + '?url=' + encodeURIComponent(url), (function(map, data) {
url = proxy + '?url=' + encodeURIComponent(url);
var oReq = new XMLHttpRequest();
oReq.addEventListener("load", (function(xhr) {
var response = xhr.currentTarget.response;
var data = JSON.parse(response);
this._baseLayer = this._createLayer(data);
this._onReadyBaseLayer();
}.bind(this, map)));
}.bind(this)));
oReq.open("GET", url);
oReq.send();
},

_createLayer: function(featurecollection) {
Expand Down Expand Up @@ -149,9 +155,17 @@ var map = L.map('map', {
center: [38.705, 1.15],
});

L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
var Esri_WorldImagery = L.tileLayer('http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
attribution: 'Tiles &copy; Esri &mdash; Source: Esri, i-cubed, USDA, USGS, ' +
'AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community'
});

var baseLayers = {
"ESRI Satellite": Esri_WorldImagery,
};

L.control.layers(baseLayers, {}).addTo(map);
Esri_WorldImagery.addTo(map);

var testWMS = "http://thredds.socib.es/thredds/wms/observational/hf_radar/hf_radar_ibiza-scb_codarssproc001_L1_agg/hf_radar_ibiza-scb_codarssproc001_L1_agg_best.ncd"
var testLayer = L.nonTiledLayer.wms(testWMS, {
Expand All @@ -165,7 +179,7 @@ var testLayer = L.nonTiledLayer.wms(testWMS, {
abovemaxcolor: "extend",
belowmincolor: "extend",
colorscalerange: "0,0.4",
attribution: 'SOCIB HF RADAR | sea_water_velocity'
attribution: 'SOCIB HF RADAR'
});
var proxy = 'server/proxy.php';
var testTimeLayer = L.timeDimension.layer.wms(testLayer, {
Expand Down

0 comments on commit b87b3dc

Please sign in to comment.