Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Mayer
CircularGreenSimCity
Commits
9ffe9e9e
Commit
9ffe9e9e
authored
May 13, 2024
by
Eric Duminil
Browse files
Merge branch 'eric_enrich_trees2'
parents
d2fd154a
4bb60f60
Changes
5
Hide whitespace changes
Inline
Side-by-side
enrich-citygml-with-greenarea/.gitignore
View file @
9ffe9e9e
...
@@ -2,6 +2,9 @@
...
@@ -2,6 +2,9 @@
# 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/*.gml
# User specific
# User specific
.sonarlint/
.sonarlint/
...
...
enrich-citygml-with-greenarea/data/Marieke/file_structure.txt
0 → 100644
View file @
9ffe9e9e
Name
.
├── 75Bäume
│ ├── Baum_IST_Grombühl_alle.cpg
│ ├── Baum_IST_Grombühl_alle.dbf
│ ├── Baum_IST_Grombühl_alle.prj
│ ├── Baum_IST_Grombühl_alle.sbn
│ ├── Baum_IST_Grombühl_alle.sbx
│ ├── Baum_IST_Grombühl_alle.shp
│ ├── 謹 Baum_IST_Grombühl_alle.shp.xml
│ ├── Baum_IST_Grombühl_alle.shx
│ ├── Grombuehl_Block_15-17.gml
│ ├── trees_75_15.cpg
│ ├── trees_75_15.dbf
│ ├── trees_75_15.prj
│ ├── trees_75_15.sbn
│ ├── trees_75_15.sbx
│ ├── trees_75_15.shp
│ ├── 謹 trees_75_15.shp.xml
│ └── trees_75_15.shx
├── 250Bäume
│ ├── Abstand5m
│ │ ├── Grombuehl_Block_15-17.gml
│ │ ├── trees_250_5.cpg
│ │ ├── trees_250_5.dbf
│ │ ├── trees_250_5.prj
│ │ ├── trees_250_5.sbn
│ │ ├── trees_250_5.sbx
│ │ ├── trees_250_5.shp
│ │ ├── 謹 trees_250_5.shp.xml
│ │ └── trees_250_5.shx
│ ├── Abstand15m
│ │ ├── 49_801844__49_802502__9_948075__9_949534_15m_Block24
│ │ │ ├── Grombuehl_Block_24.gml
│ │ │ ├── trees_250_15_kl.cpg
│ │ │ ├── trees_250_15_kl.dbf
│ │ │ ├── trees_250_15_kl.prj
│ │ │ ├── trees_250_15_kl.shp
│ │ │ └── trees_250_15_kl.shx
│ │ └── 49_802605__49_804087__9_94036__9_948417_15m_Block7-11_14-17
│ │ ├── Grombuehl_Block_7-11_14-17.gml
│ │ ├── trees_150_15_gr.cpg
│ │ ├── trees_150_15_gr.dbf
│ │ ├── trees_150_15_gr.prj
│ │ ├── trees_150_15_gr.sbn
│ │ ├── trees_150_15_gr.sbx
│ │ ├── trees_150_15_gr.shp
│ │ ├── 謹 trees_150_15_gr.shp.xml
│ │ └── trees_150_15_gr.shx
│ ├── Baum_IST_Grombühl_alle.cpg
│ ├── Baum_IST_Grombühl_alle.dbf
│ ├── Baum_IST_Grombühl_alle.prj
│ ├── Baum_IST_Grombühl_alle.sbn
│ ├── Baum_IST_Grombühl_alle.sbx
│ ├── Baum_IST_Grombühl_alle.shp
│ ├── 謹 Baum_IST_Grombühl_alle.shp.xml
│ └── Baum_IST_Grombühl_alle.shx
├── 500Bäume
│ ├── Abstand10m
│ │ ├── 49_801844__49_802502__9_948075__9_949534_10m_block_24
│ │ │ ├── Grombuehl_Block_24.gml
│ │ │ ├── trees_500_10_kl.cpg
│ │ │ ├── trees_500_10_kl.dbf
│ │ │ ├── trees_500_10_kl.prj
│ │ │ ├── trees_500_10_kl.shp
│ │ │ └── trees_500_10_kl.shx
│ │ └── 49_802605__49_804087__9_94036__9_948417_10m_block_7-11_14-17
│ │ ├── Grombuehl_Block_7-11_14-17.gml
│ │ ├── trees_500_10_gr.cpg
│ │ ├── trees_500_10_gr.dbf
│ │ ├── trees_500_10_gr.prj
│ │ ├── trees_500_10_gr.sbn
│ │ ├── trees_500_10_gr.sbx
│ │ ├── trees_500_10_gr.shp
│ │ ├── 謹 trees_500_10_gr.shp.xml
│ │ └── trees_500_10_gr.shx
│ ├── Baum_IST_Grombühl_alle.cpg
│ ├── Baum_IST_Grombühl_alle.dbf
│ ├── Baum_IST_Grombühl_alle.prj
│ ├── Baum_IST_Grombühl_alle.sbn
│ ├── Baum_IST_Grombühl_alle.sbx
│ ├── Baum_IST_Grombühl_alle.shp
│ ├── 謹 Baum_IST_Grombühl_alle.shp.xml
│ └── Baum_IST_Grombühl_alle.shx
├── file_structure.txt
└── ganzes_gebiet
├── Grombühl_BA_IST.gml
├── trees_75_15.cpg
├── trees_75_15.dbf
├── trees_75_15.prj
├── trees_75_15.sbn
├── trees_75_15.sbx
├── trees_75_15.shp
├── 謹 trees_75_15.shp.xml
├── trees_75_15.shx
├── trees_250_5.cpg
├── trees_250_5.dbf
├── trees_250_5.prj
├── trees_250_5.sbn
├── trees_250_5.sbx
├── trees_250_5.shp
├── 謹 trees_250_5.shp.xml
├── trees_250_5.shx
├── trees_250_15.cpg
├── trees_250_15.dbf
├── trees_250_15.prj
├── trees_250_15.sbn
├── trees_250_15.sbx
├── trees_250_15.shp
├── 謹 trees_250_15.shp.xml
├── trees_250_15.shx
├── trees_500_10.cpg
├── trees_500_10.dbf
├── trees_500_10.prj
├── trees_500_10.sbn
├── trees_500_10.sbx
├── trees_500_10.shp
├── trees_500_10.shx
├── 謹 trees_500_10.xml
├── trees_500_15.cpg
├── trees_500_15.dbf
├── trees_500_15.prj
├── trees_500_15.sbn
├── trees_500_15.sbx
├── trees_500_15.shp
├── 謹 trees_500_15.shp.xml
└── trees_500_15.shx
enrich-citygml-with-greenarea/src/main/java/de/hft/stuttgart/citygml/green/osm/TreeUtils.java
View file @
9ffe9e9e
...
@@ -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
;
}
}
...
...
enrich-citygml-with-greenarea/src/main/java/de/hft/stuttgart/scripts/PrepareDataForMarieke.java
0 → 100644
View file @
9ffe9e9e
package
de.hft.stuttgart.scripts
;
import
java.io.File
;
import
java.io.IOException
;
import
org.citygml4j.xml.CityGMLContextException
;
import
org.citygml4j.xml.reader.CityGMLReadException
;
import
org.citygml4j.xml.writer.CityGMLWriteException
;
import
org.locationtech.jts.io.ParseException
;
import
de.hft.stuttgart.citygml.green.osm.GreenEnricher
;
import
jakarta.xml.bind.JAXBException
;
public
class
PrepareDataForMarieke
{
// Add Trees to GML files inside data/Marieke/...
public
static
void
main
(
String
[]
whatever
)
throws
Exception
{
processWholeRegion
();
processSmallBlocks
();
}
private
static
void
processSmallBlocks
()
throws
IOException
,
CityGMLContextException
,
CityGMLReadException
,
InterruptedException
,
CityGMLWriteException
,
JAXBException
,
ParseException
{
File
[]
folders
=
{
new
File
(
"data/Marieke/75Bäume/"
),
new
File
(
"data/Marieke/250Bäume/Abstand5m"
),
new
File
(
"data/Marieke/250Bäume/Abstand15m/49_801844__49_802502__9_948075__9_949534_15m_Block24"
),
new
File
(
"data/Marieke/250Bäume/Abstand15m/49_802605__49_804087__9_94036__9_948417_15m_Block7-11_14-17"
),
new
File
(
"data/Marieke/500Bäume/Abstand10m/49_801844__49_802502__9_948075__9_949534_10m_block_24"
),
new
File
(
"data/Marieke/500Bäume/Abstand10m/49_802605__49_804087__9_94036__9_948417_10m_block_7-11_14-17"
),
};
for
(
File
folder
:
folders
)
{
System
.
err
.
println
(
"### "
+
folder
);
String
gml
=
folder
.
listFiles
((
dir
,
name
)
->
name
.
endsWith
(
".gml"
))[
0
].
getName
();
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
);
}
}
}
private
static
void
processWholeRegion
()
throws
IOException
,
CityGMLContextException
,
CityGMLReadException
,
InterruptedException
,
CityGMLWriteException
,
JAXBException
,
ParseException
{
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
.
err
.
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
);
}
}
}
enrich-citygml-with-greenarea/src/test/java/de/hft/stuttgart/citygml/green/alkis/AlkisGreenEnricherTest.java
View file @
9ffe9e9e
...
@@ -40,4 +40,4 @@ class AlkisGreenEnricherTest
...
@@ -40,4 +40,4 @@ class AlkisGreenEnricherTest
GreenEnricher
.
main
(
args
);
GreenEnricher
.
main
(
args
);
assertTrue
(
Files
.
exists
(
outputGML
));
assertTrue
(
Files
.
exists
(
outputGML
));
}
}
}
}
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment