Fix toggleLayer null checkbox, add /api/real_shots route
This commit is contained in:
15
app.py.final
15
app.py.final
@@ -1671,5 +1671,20 @@ def get_coverage():
|
||||
except Exception as e:
|
||||
return jsonify({'error': str(e)}), 500
|
||||
|
||||
|
||||
@app.route('/api/real_shots')
|
||||
def get_real_shots():
|
||||
"""Get real shot positions."""
|
||||
try:
|
||||
shots_file = os.path.join(os.path.dirname(__file__), 'static', 'real_shots.json')
|
||||
if not os.path.exists(shots_file):
|
||||
shots_file = os.path.join(os.path.dirname(__file__), '..', 'real_shots.json')
|
||||
if os.path.exists(shots_file):
|
||||
with open(shots_file) as f:
|
||||
return jsonify(json.load(f))
|
||||
return jsonify({'features': [], 'type': 'FeatureCollection'})
|
||||
except Exception as e:
|
||||
return jsonify({'error': str(e)}), 500
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(host='0.0.0.0', port=3001, debug=False)
|
||||
|
||||
@@ -1671,7 +1671,9 @@ async function loadGeosupLayers() {
|
||||
}
|
||||
|
||||
function toggleLayer(layerName) {
|
||||
const checkbox = document.getElementById('layer' + layerName.charAt(0).toUpperCase() + layerName.slice(1));
|
||||
var idMap = {sources:'layerSources', receivers:'layerReceivers', deployments:'layerDeployments', aslaid:'layerAslaid', realshots:'layerRealShots', files:'layerFiles'};
|
||||
var checkbox = document.getElementById(idMap[layerName] || ('layer' + layerName.charAt(0).toUpperCase() + layerName.slice(1)));
|
||||
if (!checkbox) return;
|
||||
layerVisibility[layerName] = checkbox.checked;
|
||||
|
||||
if (layerName === 'files') {
|
||||
|
||||
Reference in New Issue
Block a user