src/sidebar/Sidebar.js
// Gets call from Dissolve and sends data to MainMap and Layer
Gets call from Dissolve and sends data to MainMap and Layer
Gets call from Dissolve and sends data to MainMap and Layer
function callDissolve(geojson_file_key) {
  var layer_position = find_called_geojson(geojson_file_key)
  var selected_layer_geojson = collect_called_geojson(layer_position)
  var selected_layer_name = this.state.layer_list[layer_position][0]
  var dissolveLayer = selected_layer_geojson.features[0]
  for (var i = 1; i < selected_layer_geojson.features.length; i++) {
    dissolveLayer = turf.union(dissolveLayer, selected_layer_geojson.features[i])
  }
  if (dissolveLayer.geometry.type == 'MultiPolygon') {
    var multipolygon = {"type":"FeatureCollection","features": [dissolveLayer]};
    final_dissolve = geojsonMultiPolygonToPolygon(multipolygon)
  } else {
    var final_dissolve = {"type":"FeatureCollection","features": [dissolveLayer]};
  }
  const dissolve_layer_key = generateKey()
  get_newgeojson(final_dissolve, dissolve_layer_key)
  createLayer(selected_layer_name+' dissolved', dissolve_layer_key, final_dissolve)
}
function callDissolve ( geojson_file_key ) { var layer_position = find_called_geojson ( geojson_file_key ) var selected_layer_geojson = collect_called_geojson ( layer_position ) var selected_layer_name = this . state . layer_list [ layer_position ] [ 0 ] var dissolveLayer = selected_layer_geojson . features [ 0 ] for ( var i = 1 ; i < selected_layer_geojson . features . length ; i ++ ) { dissolveLayer = turf . union ( dissolveLayer , selected_layer_geojson . features [ i ] ) } if ( dissolveLayer . geometry . type == 'MultiPolygon' ) { var multipolygon = { "type" : "FeatureCollection" , "features" : [ dissolveLayer ] } ; final_dissolve = geojsonMultiPolygonToPolygon ( multipolygon ) } else { var final_dissolve = { "type" : "FeatureCollection" , "features" : [ dissolveLayer ] } ; } const dissolve_layer_key = generateKey ( ) get_newgeojson ( final_dissolve , dissolve_layer_key ) createLayer ( selected_layer_name + ' dissolved' , dissolve_layer_key , final_dissolve ) }
Gets call from Dissolve and sends data to MainMap and Layer
Gets call from Dissolve and sends data to MainMap and Layer
/* The Turf.JS code for dissolve is not working as intended (said by author).
  Therefore we use union instead, on all polygons within geojson file. */ // Cleans the returned dissolve data.