Loading app/package.json +1 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,7 @@ "webpack-merge": "^4.2.2" }, "dependencies": { "jquery": "^3.4.1", "@material-ui/core": "^4.9.0", "@material-ui/icons": "^4.5.1", "@material-ui/lab": "^4.0.0-alpha.41", Loading app/src/js/AstroMap.js +46 −6 Original line number Diff line number Diff line import AstroProj from "./AstroProj"; import LayerCollection from "./LayerCollection"; import $ from "jquery"; /* * @class AstroMap * @aka L.Map.AstroMap Loading Loading @@ -46,14 +47,12 @@ export default L.Map.AstroMap = L.Map.extend({ if (this.layers["northPolar"].isEmpty()) { this._hasNorthPolar = false; } else { } else { this._hasNorthPolar = true; } if (this.layers["southPolar"].isEmpty()) { this._hasSouthPolar = false; } else { } else { this._hasSouthPolar = true; } Loading @@ -63,6 +62,16 @@ export default L.Map.AstroMap = L.Map.extend({ L.setOptions(this, options); L.Map.prototype.initialize.call(this, this.mapDiv, this.options); this.loadLayerCollection("cylindrical"); this.featureLayer = new L.GeoJSON(null, { onEachFeature: function(feature, layer) { if (feature.properties && feature.properties.name) { layer.bindPopup(feature.properties.name); } } }).addTo(this); this.load_wfs(); this.on("moveend", this.load_wfs); }, /** Loading Loading @@ -104,4 +113,35 @@ export default L.Map.AstroMap = L.Map.extend({ hasSouthPolar: function() { return this._hasSouthPolar; }, load_wfs: function() { var geoJsonUrl = "https://astrocloud.wr.usgs.gov/dataset/data/nomenclature/" + this.target.toUpperCase() + "/WFS"; var defaultParameters = { service: "WFS", version: "1.1.0", request: "GetFeature", outputFormat: "application/json", srsName: "EPSG:4326" }; var customParams = { bbox: this.getBounds().toBBoxString() }; var parameters = L.Util.extend(defaultParameters, customParams); console.log(geoJsonUrl + L.Util.getParamString(parameters)); var that = this; $.ajax({ url: geoJsonUrl + L.Util.getParamString(parameters), dataType: "json", timeout: 30000, success: function(data) { // this.featureLayer.clearLayers(); that.featureLayer.addData(data); } }); } }); Loading
app/package.json +1 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,7 @@ "webpack-merge": "^4.2.2" }, "dependencies": { "jquery": "^3.4.1", "@material-ui/core": "^4.9.0", "@material-ui/icons": "^4.5.1", "@material-ui/lab": "^4.0.0-alpha.41", Loading
app/src/js/AstroMap.js +46 −6 Original line number Diff line number Diff line import AstroProj from "./AstroProj"; import LayerCollection from "./LayerCollection"; import $ from "jquery"; /* * @class AstroMap * @aka L.Map.AstroMap Loading Loading @@ -46,14 +47,12 @@ export default L.Map.AstroMap = L.Map.extend({ if (this.layers["northPolar"].isEmpty()) { this._hasNorthPolar = false; } else { } else { this._hasNorthPolar = true; } if (this.layers["southPolar"].isEmpty()) { this._hasSouthPolar = false; } else { } else { this._hasSouthPolar = true; } Loading @@ -63,6 +62,16 @@ export default L.Map.AstroMap = L.Map.extend({ L.setOptions(this, options); L.Map.prototype.initialize.call(this, this.mapDiv, this.options); this.loadLayerCollection("cylindrical"); this.featureLayer = new L.GeoJSON(null, { onEachFeature: function(feature, layer) { if (feature.properties && feature.properties.name) { layer.bindPopup(feature.properties.name); } } }).addTo(this); this.load_wfs(); this.on("moveend", this.load_wfs); }, /** Loading Loading @@ -104,4 +113,35 @@ export default L.Map.AstroMap = L.Map.extend({ hasSouthPolar: function() { return this._hasSouthPolar; }, load_wfs: function() { var geoJsonUrl = "https://astrocloud.wr.usgs.gov/dataset/data/nomenclature/" + this.target.toUpperCase() + "/WFS"; var defaultParameters = { service: "WFS", version: "1.1.0", request: "GetFeature", outputFormat: "application/json", srsName: "EPSG:4326" }; var customParams = { bbox: this.getBounds().toBBoxString() }; var parameters = L.Util.extend(defaultParameters, customParams); console.log(geoJsonUrl + L.Util.getParamString(parameters)); var that = this; $.ajax({ url: geoJsonUrl + L.Util.getParamString(parameters), dataType: "json", timeout: 30000, success: function(data) { // this.featureLayer.clearLayers(); that.featureLayer.addData(data); } }); } });