src/sidebar/Sidebar.js
// Gets call from Union and sends data to MainMap and Layer
Gets call from Union and sends data to MainMap and Layer
Gets call from Union and sends data to MainMap and Layer
function callUnion(geojson_file_key1, geojson_file_key2) {
  var layer_position1 = find_called_geojson(geojson_file_key1)
  var selected_layer_geojson1 = collect_called_geojson(layer_position1)
  var selected_layer_name1 = this.state.layer_list[layer_position1][0]
  var layer_position2 = find_called_geojson(geojson_file_key2)
  var selected_layer_geojson2 = collect_called_geojson(layer_position2)
  var selected_layer_name2 = this.state.layer_list[layer_position2][0]
  var unionLayer = {
    "type" : "FeatureCollection",
    "features": [...selected_layer_geojson1.features, ...selected_layer_geojson2.features]
  }
  const union_layer_key = generateKey()
  get_newgeojson(unionLayer, union_layer_key)
  createLayer('union '+selected_layer_name1+' & '+selected_layer_name2, union_layer_key, unionLayer)
}
function callUnion ( geojson_file_key1 , geojson_file_key2 ) { var layer_position1 = find_called_geojson ( geojson_file_key1 ) var selected_layer_geojson1 = collect_called_geojson ( layer_position1 ) var selected_layer_name1 = this . state . layer_list [ layer_position1 ] [ 0 ] var layer_position2 = find_called_geojson ( geojson_file_key2 ) var selected_layer_geojson2 = collect_called_geojson ( layer_position2 ) var selected_layer_name2 = this . state . layer_list [ layer_position2 ] [ 0 ] var unionLayer = { "type" : "FeatureCollection" , "features" : [ ... selected_layer_geojson1 . features , ... selected_layer_geojson2 . features ] } const union_layer_key = generateKey ( ) get_newgeojson ( unionLayer , union_layer_key ) createLayer ( 'union ' + selected_layer_name1 + ' & ' + selected_layer_name2 , union_layer_key , unionLayer ) }
Gets call from Union and sends data to MainMap and Layer
Gets call from Union and sends data to MainMap and Layer
/*NOTE:  As the union function uses polygons not geojson files as input,
  we need to seperate the geojson files into features and merge all of them. */ // gets the data for the first geojson file stored in memory. // gets the data for the second geojson file stored in memory. // combines the geojson files into one, in case we have mulitple features in one of them.