summaryrefslogtreecommitdiff
path: root/index.html.in
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2020-01-03 00:35:51 +0100
committerEven Rouault <even.rouault@spatialys.com>2020-01-03 00:35:51 +0100
commitdc743b91402484baefdd70434f01918dfaae1887 (patch)
tree5d9afa712c0895127029d196c7c4d1fb184b5c58 /index.html.in
parentf2433d2ad0da0662107ebe2f4a129db626deacff (diff)
downloadPROJ-data-dc743b91402484baefdd70434f01918dfaae1887.tar.gz
PROJ-data-dc743b91402484baefdd70434f01918dfaae1887.zip
index.html: dynamically create agency list
Diffstat (limited to 'index.html.in')
-rw-r--r--index.html.in52
1 files changed, 17 insertions, 35 deletions
diff --git a/index.html.in b/index.html.in
index ec8150b..c30376d 100644
--- a/index.html.in
+++ b/index.html.in
@@ -110,6 +110,8 @@ the data: </p>
<script>
var fullGeoJSON = null;
+var agencies_enabled = {}
+var list_agencies = []
var featureSource = new ol.source.Vector({
format: new ol.format.GeoJSON(),
@@ -121,6 +123,21 @@ var featureSource = new ol.source.Vector({
xhr.onload = function() {
if (xhr.status == 200) {
fullGeoJSON = JSON.parse(xhr.responseText);
+
+ fullGeoJSON.features.forEach(function(f) {
+ if( agencies_enabled[f.properties.source_id] === undefined ) {
+ agencies_enabled[f.properties.source_id] = true;
+ list_agencies.push(f.properties.source_id);
+ }
+ });
+
+ list_agencies.sort();
+ var agency_control = document.getElementById('agency_control');
+ list_agencies.forEach(function(x){
+ create_checkbox(x, x, agency_control, agencies_enabled);
+ });
+
+
featureSource.addFeatures(
featureSource.getFormat().readFeatures(fullGeoJSON,
{
@@ -155,36 +172,6 @@ types_enabled['geoid'] = true;
types_enabled['vertical_adjustments'] = true;
types_enabled['velocity'] = true;
types_enabled['other'] = true;
-
-var list_agencies = [
- "at_bev",
- "au_ga",
- "au_icsm",
- "be_ign",
- "ca_nrc",
- "ca_que_mern",
- "ch_swisstopo",
- "de_adv",
- "de_geosn",
- "de_lgl_bw",
- "de_lgvl_saarland",
- "dk_sdfe",
- "es_cat_icgc",
- "eur_nkg",
- "fr_ign",
- "is_lmi",
- "nz_linz",
- "pt_dgt",
- "se_lantmateriet",
- "uk_os",
- "us_noaa",
- "us_nga"
-]
-var agencies_enabled = {}
-list_agencies.forEach(function(x){
- agencies_enabled[x] = true;
-});
-
function refresh_source() {
featureSource.clear();
var filtered = {
@@ -254,11 +241,6 @@ create_checkbox('vertical_adjustments', 'Vertical shifts', type_control, types_e
create_checkbox('velocity', 'Velocity grids', type_control, types_enabled);
create_checkbox('other', 'Other grids', type_control, types_enabled);
-var agency_control = document.getElementById('agency_control');
-list_agencies.forEach(function(x){
- create_checkbox(x, x, agency_control, agencies_enabled);
-});
-
/**
* Elements that make up the popup.
*/