def test_union(self): """Test we can union two layers like hazard and aggregation (1).""" union_a = load_test_vector_layer('gisv4', 'hazard', 'classified_vector.geojson') union_a.keywords['inasafe_fields'][hazard_class_field['key']] = ( union_a.keywords['inasafe_fields'][hazard_value_field['key']]) union_b = load_test_vector_layer('gisv4', 'aggregation', 'small_grid.geojson') layer = union(union_a, union_b) self.assertEqual(layer.featureCount(), 11) self.assertEqual(union_a.fields().count() + union_b.fields().count(), layer.fields().count())
def test_union_error(self): """Test we can union two layers like hazard and aggregation (2).""" union_a = clean_layer( load_test_vector_layer('gisv4', 'hazard', 'union_check_hazard.geojson')) union_a.keywords['inasafe_fields'][hazard_class_field['key']] = ( union_a.keywords['inasafe_fields'][hazard_value_field['key']]) union_b = clean_layer( load_test_vector_layer('gisv4', 'aggregation', 'union_check_aggregation.geojson')) layer = union(union_a, union_b) self.assertEqual(layer.featureCount(), 11) self.assertEqual(union_a.fields().count() + union_b.fields().count(), layer.fields().count())
def test_union_error(self): """Test we can union two layers like hazard and aggregation (2).""" union_a = clean_layer(load_test_vector_layer( 'gisv4', 'hazard', 'union_check_hazard.geojson')) union_a.keywords['inasafe_fields'][hazard_class_field['key']] = ( union_a.keywords['inasafe_fields'][hazard_value_field['key']]) union_b = clean_layer(load_test_vector_layer( 'gisv4', 'aggregation', 'union_check_aggregation.geojson')) layer = union(union_a, union_b) self.assertEqual(layer.featureCount(), 11) self.assertEqual( union_a.fields().count() + union_b.fields().count(), layer.fields().count() )
def test_union(self): """Test we can union two layers like hazard and aggregation (1).""" union_a = load_test_vector_layer( 'gisv4', 'hazard', 'classified_vector.geojson') union_a.keywords['inasafe_fields'][hazard_class_field['key']] = ( union_a.keywords['inasafe_fields'][hazard_value_field['key']]) union_b = load_test_vector_layer( 'gisv4', 'aggregation', 'small_grid.geojson') layer = union(union_a, union_b) self.assertEqual(layer.featureCount(), 11) self.assertEqual( union_a.fields().count() + union_b.fields().count(), layer.fields().count() )