Commit 00ed1cf4 authored by Eric Duminil's avatar Eric Duminil
Browse files

Script for Marieke

parent d2fd154a
...@@ -2,6 +2,13 @@ ...@@ -2,6 +2,13 @@
# Created by https://www.gitignore.io/api/java,maven,macos,linux,eclipse,windows,netbeans,intellij # Created by https://www.gitignore.io/api/java,maven,macos,linux,eclipse,windows,netbeans,intellij
# Edit at https://www.gitignore.io/?templates=java,maven,macos,linux,eclipse,windows,netbeans,intellij # Edit at https://www.gitignore.io/?templates=java,maven,macos,linux,eclipse,windows,netbeans,intellij
data/Marieke
data/Grombühl_BA_IST_trees_250_15.gml
data/Grombühl_BA_IST_trees_250_5.gml
data/Grombühl_BA_IST_trees_500_10.gml
data/Grombühl_BA_IST_trees_500_15.gml
data/Grombühl_BA_IST_trees_75_15.gml
# User specific # User specific
.sonarlint/ .sonarlint/
......
...@@ -15,7 +15,9 @@ import org.xmlobjects.gml.model.geometry.aggregates.MultiSurface; ...@@ -15,7 +15,9 @@ import org.xmlobjects.gml.model.geometry.aggregates.MultiSurface;
import org.xmlobjects.gml.model.geometry.aggregates.MultiSurfaceProperty; import org.xmlobjects.gml.model.geometry.aggregates.MultiSurfaceProperty;
import org.xmlobjects.gml.model.measures.Length; import org.xmlobjects.gml.model.measures.Length;
public class TreeUtils {
public class TreeUtils
{
private static final GeometryFactory FACTORY = new GeometryFactory(); private static final GeometryFactory FACTORY = new GeometryFactory();
...@@ -30,10 +32,10 @@ public class TreeUtils { ...@@ -30,10 +32,10 @@ public class TreeUtils {
// generateTreesFromKataster(cityModel, katasterData2); // generateTreesFromKataster(cityModel, katasterData2);
// All kataster trees are taken, osm trees are removed // All kataster trees are taken, osm trees are removed
// filterDuplicateTreesFromOSM(osmData, katasterData); // filterDuplicateTreesFromOSM(osmData, katasterData);
// filterDuplicateTreesFromOSM(osmData, katasterData2); // filterDuplicateTreesFromOSM(osmData, katasterData2);
// generateTreesFromOSM(cityModel, osmData, wktPolygon); // generateTreesFromOSM(cityModel, osmData, wktPolygon);
} }
...@@ -81,7 +83,8 @@ public class TreeUtils { ...@@ -81,7 +83,8 @@ public class TreeUtils {
// check if tree is in area // check if tree is in area
Coordinate coordinate = tree.getPoint().getCoordinate(); Coordinate coordinate = tree.getPoint().getCoordinate();
if ((wktPolygon != null && !wktPolygon.contains(FACTORY.createPoint(coordinate))) if ((wktPolygon != null && !wktPolygon.contains(FACTORY.createPoint(coordinate)))
|| !osmData.getBoundingBox().contains(FACTORY.createPoint(coordinate))) { || osmData.getBoundingBox() != null
&& !osmData.getBoundingBox().contains(FACTORY.createPoint(coordinate))) {
continue; continue;
} }
......
package de.hft.stuttgart.citygml.green.alkis; package de.hft.stuttgart.citygml.green.alkis;
import static org.junit.jupiter.api.Assertions.assertFalse; import java.io.File;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import de.hft.stuttgart.citygml.green.osm.GreenEnricher; import de.hft.stuttgart.citygml.green.osm.GreenEnricher;
class AlkisGreenEnricherTest class AlkisGreenEnricherTest
{ {
@Test // @Test
void testAlkisGreen() throws Exception { // void testAlkisGreen() throws Exception {
//NOTE: From https://transfer.hft-stuttgart.de/gitlab/circulargreensimcity/circulargreensimcity/-/wikis/Fallstudien/Gromb%C3%BChl // //NOTE: From https://transfer.hft-stuttgart.de/gitlab/circulargreensimcity/circulargreensimcity/-/wikis/Fallstudien/Gromb%C3%BChl
Path outputGML = Paths.get("data/Grombühl_v4_case_study_alkis_test.gml"); // Path outputGML = Paths.get("data/Grombühl_v4_case_study_alkis_test.gml");
Files.deleteIfExists(outputGML); // Files.deleteIfExists(outputGML);
assertFalse(Files.exists(outputGML)); // assertFalse(Files.exists(outputGML));
String[] args = new String[] { "data/Grombühl_v4_case_study.gml", // Input GML // String[] args = new String[] { "data/Grombühl_v4_case_study.gml", // Input GML
"data/tn_09663/Nutzung.shp", // ALKIS Data // "data/tn_09663/Nutzung.shp", // ALKIS Data
//NOTE: From https://transfer.hft-stuttgart.de/gitlab/circulargreensimcity/circulargreensimcity/-/issues/26#note_6544 // //NOTE: From https://transfer.hft-stuttgart.de/gitlab/circulargreensimcity/circulargreensimcity/-/issues/26#note_6544
"data/Trees/Trees_realisticScenario_20240201.shp", // Added trees, in Baumkatasterformat, // "data/Trees/Trees_realisticScenario_20240201.shp", // Added trees, in Baumkatasterformat,
"alkis_test", // Output GML suffix // "alkis_test", // Output GML suffix
"POLYGON((9.946874 49.803172, 9.949785 49.803205, 9.952122 49.803312, 9.953435 49.803089, 9.956488 49.803150, 9.955465 49.802374, 9.953216 49.800916, 9.952371 49.800676, 9.951810 49.800509, 9.949172 49.800829, 9.946792 49.800796, 9.946874 49.803172))" // "POLYGON((9.946874 49.803172, 9.949785 49.803205, 9.952122 49.803312, 9.953435 49.803089, 9.956488 49.803150, 9.955465 49.802374, 9.953216 49.800916, 9.952371 49.800676, 9.951810 49.800509, 9.949172 49.800829, 9.946792 49.800796, 9.946874 49.803172))"
}; // };
AlkisGreenEnricher.main(args); // AlkisGreenEnricher.main(args);
assertTrue(Files.exists(outputGML)); // assertTrue(Files.exists(outputGML));
} // }
@Test @Test
void testGreen() throws Exception { void testGreen() throws Exception {
Path outputGML = Paths.get("data/Grombühl_v4_case_study_enrich_test.gml"); File folder = new File("data/Marieke/ganzes_gebiet/");
Files.deleteIfExists(outputGML); String gml = "Grombühl_BA_IST.gml";
assertFalse(Files.exists(outputGML)); File[] shapefiles = folder.listFiles((dir, name) -> name.endsWith(".shp"));
String[] args = new String[] { "data/Grombühl_v4_case_study.gml", // Input GML for (File shapefile : shapefiles) {
"data/Trees/Trees_realisticScenario_20240201.shp", // Added trees, in Baumkatasterformat, System.out.println(shapefile);
"enrich_test" // Output GML suffix String extension = shapefile.getName().replaceAll("\\.shp", "");
String[] args = new String[] { folder.toPath().resolve(gml).toString(), // Input GML
shapefile.toString(), // Added trees, in Baumkatasterformat,
extension, // Output GML suffix
}; };
GreenEnricher.main(args); GreenEnricher.main(args);
assertTrue(Files.exists(outputGML)); }
// assertTrue(Files.exists(outputGML));
} }
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment