Commit eb6b5464 authored by Matthias Betz's avatar Matthias Betz
Browse files

update green enricher

parent 9ae6dab1
...@@ -91,7 +91,7 @@ public class AlkisGreenEnricher { ...@@ -91,7 +91,7 @@ public class AlkisGreenEnricher {
String inputString = inFile.getFileName().toString(); String inputString = inFile.getFileName().toString();
String inputPathWithoutFileEnding = inputString.substring(0, inputString.lastIndexOf('.')); String inputPathWithoutFileEnding = inputString.substring(0, inputString.lastIndexOf('.'));
Path outputPath = Paths.get("data", inputPathWithoutFileEnding + "_with_alkis_greens.gml"); Path outputPath = Paths.get("data", inputPathWithoutFileEnding + "_with_alkis_greens_realistic.gml");
System.out.println("Writing output file."); System.out.println("Writing output file.");
GreenEnricher.writeCityGML(cityModel, outputPath); GreenEnricher.writeCityGML(cityModel, outputPath);
System.out.println("Done"); System.out.println("Done");
......
...@@ -65,8 +65,11 @@ public class TreeKatasterData { ...@@ -65,8 +65,11 @@ public class TreeKatasterData {
if (trunkCirc == null) { if (trunkCirc == null) {
continue; continue;
} }
tree.setTrunkRadius(Integer.parseInt(trunkCirc.toString()) / (2 * Math.PI) / 100); int circInCm = Integer.parseInt(trunkCirc.toString());
if (circInCm == 0) {
circInCm = 89;
}
tree.setTrunkRadius(circInCm / (2 * Math.PI) / 100);
result.getTrees().add(tree); result.getTrees().add(tree);
} }
} }
......
...@@ -16,11 +16,15 @@ import org.xmlobjects.gml.model.geometry.aggregates.MultiSurfaceProperty; ...@@ -16,11 +16,15 @@ import org.xmlobjects.gml.model.geometry.aggregates.MultiSurfaceProperty;
public class TreeUtils { public class TreeUtils {
public static void insertTrees(CityModel cityModel, OsmData osmData) throws IOException { public static void insertTrees(CityModel cityModel, OsmData osmData) throws IOException {
TreeKatasterData katasterData = TreeKatasterData.parseTreeKatasterData(Paths.get("data", "Baum.shp")); TreeKatasterData katasterData = TreeKatasterData.parseTreeKatasterData(Paths.get("data", "Trees_realisticScenario_20240201.shp"));
generateTreesFromKataster(cityModel, katasterData); generateTreesFromKataster(cityModel, katasterData);
// TreeKatasterData katasterData2 = TreeKatasterData.parseTreeKatasterData(Paths.get("data", "Trees_realistic_20240201.shp"));
// 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);
generateTreesFromOSM(cityModel, osmData); generateTreesFromOSM(cityModel, osmData);
...@@ -52,7 +56,7 @@ public class TreeUtils { ...@@ -52,7 +56,7 @@ public class TreeUtils {
MultiSurface generatedTree = TreeGenerator.generateTree(coordinate, trunkRadius, trunkHeight, crownRadius, MultiSurface generatedTree = TreeGenerator.generateTree(coordinate, trunkRadius, trunkHeight, crownRadius,
crownRadius, crownHeight); crownRadius, crownHeight);
SolitaryVegetationObject cover = new SolitaryVegetationObject(); SolitaryVegetationObject cover = new SolitaryVegetationObject();
cover.setSpecies(new Code("Acer campestre")); cover.setSpecies(new Code("Acer platanoides"));
cover.setId(UUID.randomUUID().toString()); cover.setId(UUID.randomUUID().toString());
cover.setLod2MultiSurface(new MultiSurfaceProperty(generatedTree)); cover.setLod2MultiSurface(new MultiSurfaceProperty(generatedTree));
cityModel.getCityObjectMembers().add(new AbstractCityObjectProperty(cover)); cityModel.getCityObjectMembers().add(new AbstractCityObjectProperty(cover));
......
...@@ -13,7 +13,7 @@ class AlkisGreenEnricherTest { ...@@ -13,7 +13,7 @@ class AlkisGreenEnricherTest {
@Test @Test
void testAlkisGreen() throws IOException, CityGMLContextException, CityGMLReadException, JAXBException, CityGMLWriteException { void testAlkisGreen() throws IOException, CityGMLContextException, CityGMLReadException, JAXBException, CityGMLWriteException {
String[] args = new String[] {"data/Grombühl_v3.gml"}; String[] args = new String[] {"data/Grombühl_v4_case_study.gml"};
AlkisGreenEnricher.main(args); AlkisGreenEnricher.main(args);
} }
......
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