src/sidebar/Layers.js
// Function that creates a file for selected layer to download.
Function that creates a file for selected layer to download.
Function that creates a file for selected layer to download .
function download(geojson_key) {
  var download_layer_key= ($('li.active').attr('id'));
  for (var i = 0; i < this.state.layer_list.length; i++) {
    if (download_layer_key == this.state.layer_list[i][1]){
      var layer_position = i
    }
  }
  var geojson_file = this.state.layer_list[layer_position][2]
  var geojson_file_name = this.state.layer_list[layer_position][0]
  var filename = geojson_file_name.split(' ').join('_');
  var filename = filename.replace('.geojson', '');
  var blob = new Blob([JSON.stringify(geojson_file)], {type: "geojson;charset=utf-8"});
  FileSaver.saveAs(blob, filename+".geojson");
}
function download ( geojson_key ) { var download_layer_key = ( $ ( 'li.active' ) . attr ( 'id' ) ) ; for ( var i = 0 ; i < this . state . layer_list . length ; i ++ ) { if ( download_layer_key == this . state . layer_list [ i ] [ 1 ] ) { var layer_position = i } } var geojson_file = this . state . layer_list [ layer_position ] [ 2 ] var geojson_file_name = this . state . layer_list [ layer_position ] [ 0 ] var filename = geojson_file_name . split ( ' ' ) . join ( '_' ) ; var filename = filename . replace ( '.geojson' , '' ) ; var blob = new Blob ( [ JSON . stringify ( geojson_file ) ] , { type : "geojson;charset=utf-8" } ) ; FileSaver . saveAs ( blob , filename + ".geojson" ) ; }
Function that creates a file for selected layer to download.
Function that creates a file for selected layer to download .