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

Script for Marieke

parent d2fd154a
......@@ -2,6 +2,13 @@
# 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
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
.sonarlint/
......
......@@ -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.measures.Length;
public class TreeUtils {
public class TreeUtils
{
private static final GeometryFactory FACTORY = new GeometryFactory();
......@@ -30,10 +32,10 @@ public class TreeUtils {
// generateTreesFromKataster(cityModel, katasterData2);
// All kataster trees are taken, osm trees are removed
// filterDuplicateTreesFromOSM(osmData, katasterData);
// filterDuplicateTreesFromOSM(osmData, katasterData);
// filterDuplicateTreesFromOSM(osmData, katasterData2);
// generateTreesFromOSM(cityModel, osmData, wktPolygon);
// generateTreesFromOSM(cityModel, osmData, wktPolygon);
}
......@@ -81,7 +83,8 @@ public class TreeUtils {
// check if tree is in area
Coordinate coordinate = tree.getPoint().getCoordinate();
if ((wktPolygon != null && !wktPolygon.contains(FACTORY.createPoint(coordinate)))
|| !osmData.getBoundingBox().contains(FACTORY.createPoint(coordinate))) {
|| osmData.getBoundingBox() != null
&& !osmData.getBoundingBox().contains(FACTORY.createPoint(coordinate))) {
continue;
}
......
package de.hft.stuttgart.citygml.green.alkis;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.io.File;
import org.junit.jupiter.api.Test;
import de.hft.stuttgart.citygml.green.osm.GreenEnricher;
class AlkisGreenEnricherTest
{
@Test
void testAlkisGreen() throws Exception {
//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");
Files.deleteIfExists(outputGML);
assertFalse(Files.exists(outputGML));
String[] args = new String[] { "data/Grombühl_v4_case_study.gml", // Input GML
"data/tn_09663/Nutzung.shp", // ALKIS Data
//NOTE: From https://transfer.hft-stuttgart.de/gitlab/circulargreensimcity/circulargreensimcity/-/issues/26#note_6544
"data/Trees/Trees_realisticScenario_20240201.shp", // Added trees, in Baumkatasterformat,
"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))"
};
AlkisGreenEnricher.main(args);
assertTrue(Files.exists(outputGML));
}
// @Test
// void testAlkisGreen() throws Exception {
// //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");
// Files.deleteIfExists(outputGML);
// assertFalse(Files.exists(outputGML));
// String[] args = new String[] { "data/Grombühl_v4_case_study.gml", // Input GML
// "data/tn_09663/Nutzung.shp", // ALKIS Data
// //NOTE: From https://transfer.hft-stuttgart.de/gitlab/circulargreensimcity/circulargreensimcity/-/issues/26#note_6544
// "data/Trees/Trees_realisticScenario_20240201.shp", // Added trees, in Baumkatasterformat,
// "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))"
// };
// AlkisGreenEnricher.main(args);
// assertTrue(Files.exists(outputGML));
// }
@Test
void testGreen() throws Exception {
Path outputGML = Paths.get("data/Grombühl_v4_case_study_enrich_test.gml");
Files.deleteIfExists(outputGML);
assertFalse(Files.exists(outputGML));
String[] args = new String[] { "data/Grombühl_v4_case_study.gml", // Input GML
"data/Trees/Trees_realisticScenario_20240201.shp", // Added trees, in Baumkatasterformat,
"enrich_test" // Output GML suffix
};
GreenEnricher.main(args);
assertTrue(Files.exists(outputGML));
File folder = new File("data/Marieke/ganzes_gebiet/");
String gml = "Grombühl_BA_IST.gml";
File[] shapefiles = folder.listFiles((dir, name) -> name.endsWith(".shp"));
for (File shapefile : shapefiles) {
System.out.println(shapefile);
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);
}
// 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