Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Eric Duminil
RegionChooser
Commits
a66b863e
Commit
a66b863e
authored
Jun 15, 2016
by
duminil
Browse files
RegionChooser: Merged NAD83 and GSK3.
parent
529767f4
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/eu/simstadt/regionchooser/RegionChooserBrowser.java
View file @
a66b863e
...
...
@@ -92,9 +92,11 @@ public void extractZIPtoGML(String zipFilename) throws IOException {
zipFile
.
close
();
}
public
void
downloadRegionFromCityGML
(
String
wktPolygon
,
String
project
,
String
citygml
)
throws
IOException
,
public
void
downloadRegionFromCityGML
(
String
wktPolygon
,
String
project
,
String
citygml
,
String
srsName
)
throws
IOException
,
ParseException
,
SAXParseException
,
XMLStreamException
{
StringBuffer
sb
=
RegionExtractor
.
selectRegionDirectlyFromCityGML
(
citygmlPath
(
project
,
citygml
),
wktPolygon
);
StringBuffer
sb
=
RegionExtractor
.
selectRegionDirectlyFromCityGML
(
citygmlPath
(
project
,
citygml
),
wktPolygon
,
srsName
);
File
buildingIdsFile
=
selectSaveFileWithDialog
(
project
,
citygml
,
"selected_region"
);
if
(
buildingIdsFile
!=
null
)
{
...
...
src/eu/simstadt/regionchooser/RegionExtractor.java
View file @
a66b863e
...
...
@@ -14,23 +14,17 @@
import
com.vividsolutions.jts.geom.Point
;
import
com.vividsolutions.jts.io.ParseException
;
import
com.vividsolutions.jts.io.WKTReader
;
import
de.hft.stuttgart.citydoctor.writer.CityDoctorModel
;
import
eu.simstadt.geo.GeoCoordinatesAccessor
;
public
class
RegionExtractor
{
static
private
WKTReader
wktReader
=
new
WKTReader
();
static
public
StringBuffer
selectRegionDirectlyFromCityGML
(
Path
citygmlPath
,
String
wktPolygon
)
static
public
StringBuffer
selectRegionDirectlyFromCityGML
(
Path
citygmlPath
,
String
wktPolygon
,
String
srsName
)
throws
IOException
,
ParseException
,
SAXParseException
,
XMLStreamException
{
//TODO: wktPolygon should be in WGS84, and converted here to locate coordinates system
CityDoctorModel
model
=
CityDoctorModel
.
loadWithEnergyADEAndNoSchemaValidation
(
citygmlPath
.
toFile
());
//TODO: Could extract srsName directly from citygml header. It would be much faster for big files
GeoCoordinatesAccessor
coordinates
=
GeoCoordinatesAccessor
.
coordinatesComputedFromBuildingsIfNeeded
(
model
);
String
srsName
=
coordinates
.
getCoordinateReferenceSystem
().
getName
();
Geometry
poly
=
wktReader
.
read
(
wktPolygon
);
final
GeometryFactory
gf
=
new
GeometryFactory
();
//TODO: Don't read all the file. Not possible for 15GB gml files
String
s
=
new
String
(
Files
.
readAllBytes
(
citygmlPath
),
Charset
.
defaultCharset
());
...
...
@@ -39,7 +33,9 @@ static public StringBuffer selectRegionDirectlyFromCityGML(Path citygmlPath, Str
.
compile
(
"(?s)<(core:)?cityObjectMember[^>]*>.*?<\\/(core:)?cityObjectMember>\\s*"
);
Pattern
coordinatesPattern
=
null
;
switch
(
srsName
)
{
switch
(
srsName
)
{
case
"EPSG:31467"
:
coordinatesPattern
=
Pattern
.
compile
(
"(?<![\\d\\.])(3\\d\\d\\d\\d\\d\\d[\\.\\d]*) (5\\d\\d\\d\\d\\d\\d[\\.\\d]*)"
);
...
...
@@ -51,10 +47,13 @@ static public StringBuffer selectRegionDirectlyFromCityGML(Path citygmlPath, Str
default
:
throw
new
IllegalArgumentException
(
"Sorry. "
+
srsName
+
" is not supported yet."
);
}
Matcher
cityObjectMatcher
=
cityObjectPattern
.
matcher
(
s
);
StringBuffer
sb
=
new
StringBuffer
();
int
i
=
0
;
while
(
cityObjectMatcher
.
find
())
{
while
(
cityObjectMatcher
.
find
())
{
cityObjectMatcher
.
appendReplacement
(
sb
,
""
);
String
cityObject
=
cityObjectMatcher
.
group
();
Matcher
coordinatesMatcher
=
coordinatesPattern
.
matcher
(
cityObject
);
...
...
@@ -76,7 +75,9 @@ static public StringBuffer selectRegionDirectlyFromCityGML(Path citygmlPath, Str
}
}
System
.
out
.
println
(
"Buildings found in selected region "
+
i
);
if
(
i
>
0
)
{
if
(
i
>
0
)
{
cityObjectMatcher
.
appendTail
(
sb
);
}
return
sb
;
...
...
src/eu/simstadt/regionchooser/website/data/citygml_hulls.kml
View file @
a66b863e
...
...
@@ -487,6 +487,9 @@
<Data
name=
"project"
>
<value>
NewYork
</value>
</Data>
<Data
name=
"srsName"
>
<value>
EPSG:32118
</value>
</Data>
</ExtendedData>
<Polygon>
<outerBoundaryIs>
...
...
@@ -504,6 +507,9 @@
<Data
name=
"project"
>
<value>
NewYork
</value>
</Data>
<Data
name=
"srsName"
>
<value>
EPSG:32118
</value>
</Data>
</ExtendedData>
<Polygon>
<outerBoundaryIs>
...
...
@@ -521,6 +527,9 @@
<Data
name=
"project"
>
<value>
NewYork
</value>
</Data>
<Data
name=
"srsName"
>
<value>
EPSG:32118
</value>
</Data>
<Data
name=
"download_region_url"
>
<value>
http://dmz15.rz.hft-stuttgart.de:3012/projects/4/citygmls/4/download_region
</value>
</Data>
...
...
src/eu/simstadt/regionchooser/website/script/simstadt_openlayers.js
View file @
a66b863e
...
...
@@ -3,16 +3,15 @@
var
reset_btn
=
$
(
'
#reset
'
)[
0
];
var
dataPanel
=
$
(
'
#dataPanel
'
);
proj4
.
defs
(
"
EPSG:31467
"
,
"
+proj=tmerc +lat_0=0 +lon_0=9 +k=1 +x_0=3500000 +y_0=0
"
+
"
+ellps=bessel +datum=potsdam +units=m +no_defs
"
);
// http://spatialreference.org/ref/epsg/31467/proj4js/
var
wgs84Sphere
=
new
ol
.
Sphere
(
6378137
);
proj4
.
defs
(
"
EPSG:31467
"
,
"
+proj=tmerc +lat_0=0 +lon_0=9 +k=1 +x_0=3500000 +y_0=0
"
+
"
+ellps=bessel +datum=potsdam +units=m +no_defs
"
);
// http://spatialreference.org/ref/epsg/31467/proj4js/
proj4
.
defs
(
"
EPSG:32118
"
,
"
+proj=lcc +lat_1=41.03333333333333 +lat_2=40.66666666666666 +lat_0=40.16666666666666 +lon_0=-74 +x_0=300000 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs
"
);
// http://spatialreference.org/ref/epsg/32118/proj4js/
var
osm_layer
=
new
ol
.
layer
.
Tile
({
source
:
new
ol
.
source
.
OSM
()
});
var
kml_source
=
new
ol
.
source
.
KML
({
projection
:
ol
.
proj
.
get
(
'
EPSG:3857
'
),
url
:
'
data/citygml_hulls.kml
'
,
...
...
@@ -220,7 +219,8 @@ function downloadRegionFromCityGML(i) {
// Waiting 100ms in order to let the cursor change
setTimeout
(
function
()
{
// var start = new Date().getTime();
fxapp
.
downloadRegionFromCityGML
(
sketchAsWKT
(),
feature
.
get
(
"
project
"
),
feature
.
get
(
"
name
"
));
var
srsName
=
feature
.
get
(
"
srsName
"
)
||
"
EPSG:31467
"
;
fxapp
.
downloadRegionFromCityGML
(
sketchAsWKT
(
srsName
),
feature
.
get
(
"
project
"
),
feature
.
get
(
"
name
"
),
srsName
);
// var end = new Date().getTime();
// var time = end - start;
// console.log('DL Execution time: ' + time);
...
...
@@ -240,7 +240,6 @@ function displayInfo() {
var
area
=
Math
.
abs
(
wgs84Sphere
.
geodesicArea
(
coordinates
));
var
coords
=
geom
.
getLinearRing
(
0
).
getCoordinates
();
if
(
!
fromJavaFX
)
{
var
gsk3_coords
=
""
;
var
wgs84_coords
=
""
;
var
n
=
coords
.
length
;
for
(
var
i
=
0
;
i
<
n
;
i
++
)
{
...
...
@@ -249,13 +248,9 @@ function displayInfo() {
// "," + wgs84_coord[0] + "));<br/>";
wgs84_coords
+=
"
(
"
+
wgs84_coord
[
1
]
+
"
,
"
+
wgs84_coord
[
0
]
+
"
)<br/>
"
;
var
gsk3_coord
=
ol
.
proj
.
transform
(
coords
[
i
],
ol
.
proj
.
get
(
'
EPSG:4326
'
),
ol
.
proj
.
get
(
'
EPSG:31467
'
));
gsk3_coords
+=
"
(
"
+
gsk3_coord
[
0
]
+
"
,
"
+
gsk3_coord
[
1
]
+
"
)<br/>
"
;
}
dataPanel
.
append
(
"
WGS84 Coordinates<br/>
"
);
dataPanel
.
append
(
wgs84_coords
+
"
<br/>
\n
"
);
dataPanel
.
append
(
"
GSK3 Coordinates<br/>
"
);
dataPanel
.
append
(
gsk3_coords
+
"
<br/>
\n
"
);
}
dataPanel
.
append
(
"
Area
"
+
"
<br/>
\n
"
);
dataPanel
.
append
((
Math
.
round
(
area
/
1000
)
/
10
).
toString
()
+
"
ha<br/><br/>
\n
"
);
...
...
@@ -306,15 +301,15 @@ function downloadRegionFromNovaFACTORY(i) {
var
feature
=
novafactory_vectors
.
getFeatures
()[
i
];
// Waiting 100ms in order to let the cursor change
setTimeout
(
function
()
{
fxapp
.
downloadRegion
(
sketchAsWKT
(
'
4326
'
),
feature
.
get
(
'
name
'
),
novafactory_layer
);
fxapp
.
downloadRegion
(
sketchAsWKT
(),
feature
.
get
(
'
name
'
),
novafactory_layer
);
},
100
);
}
function
sketchAsWKT
(
epsgId
)
{
epsgId
=
(
typeof
epsgId
===
'
undefined
'
)
?
'
31467
'
:
epsgId
;
function
sketchAsWKT
(
srsName
)
{
srsName
=
(
typeof
srsName
===
'
undefined
'
)
?
'
EPSG:4326
'
:
srsName
;
var
wktFormat
=
new
ol
.
format
.
WKT
();
return
wktFormat
.
writeFeature
(
sketch
,
{
dataProjection
:
ol
.
proj
.
get
(
'
EPSG:
'
+
epsgId
),
dataProjection
:
ol
.
proj
.
get
(
srsName
),
featureProjection
:
ol
.
proj
.
get
(
'
EPSG:3857
'
)
});
}
...
...
src/eu/simstadt/regionchooser/website/script/simstadt_openlayers_nyc.js
deleted
100644 → 0
View file @
529767f4
//TODO: Clean up code and don't leave so many global variables
var
reset_btn
=
$
(
'
#reset
'
)[
0
];
var
dataPanel
=
$
(
'
#dataPanel
'
);
proj4
.
defs
(
"
EPSG:32118
"
,
"
+proj=lcc +lat_1=41.03333333333333 +lat_2=40.66666666666666 +lat_0=40.16666666666666 +lon_0=-74 +x_0=300000 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs
"
);
// http://spatialreference.org/ref/epsg/32118/proj4js/
var
wgs84Sphere
=
new
ol
.
Sphere
(
6378137
);
var
osm_layer
=
new
ol
.
layer
.
Tile
({
source
:
new
ol
.
source
.
OSM
()
});
var
kml_source
=
new
ol
.
source
.
KML
({
projection
:
ol
.
proj
.
get
(
'
EPSG:3857
'
),
url
:
'
data/citygml_hulls_nyc.kml
'
,
extractAttributes
:
false
,
extractStyles
:
false
});
function
polygon_style
(
color
,
alpha
)
{
return
new
ol
.
style
.
Style
({
fill
:
new
ol
.
style
.
Fill
({
color
:
'
rgba(255, 255, 255,
'
+
alpha
+
'
)
'
}),
stroke
:
new
ol
.
style
.
Stroke
({
color
:
color
,
width
:
2
,
lineDash
:
[
5
,
10
]
}),
});
}
var
kml_layer
=
new
ol
.
layer
.
Vector
({
source
:
kml_source
,
style
:
polygon_style
(
'
#777777
'
,
0.2
)
});
var
intersections
=
new
ol
.
source
.
Vector
();
var
intersections_layer
=
new
ol
.
layer
.
Vector
({
source
:
intersections
,
style
:
new
ol
.
style
.
Style
({
fill
:
new
ol
.
style
.
Fill
({
color
:
'
rgba(255, 155, 51, 0.2)
'
})
})
});
var
map
=
new
ol
.
Map
({
target
:
'
map
'
,
layers
:
[
osm_layer
,
kml_layer
,
intersections_layer
],
interactions
:
ol
.
interaction
.
defaults
({
keyboard
:
true
})
});
var
geoJSONformat
=
new
ol
.
format
.
GeoJSON
();
kml_layer
.
addEventListener
(
"
change
"
,
function
()
{
map
.
getView
().
fitExtent
(
kml_source
.
getExtent
(),
(
map
.
getSize
()));
});
function
updateGMLPolygons
()
{
kml_source
.
forEachFeature
(
function
(
feature
)
{
feature
[
"
geoJSON
"
]
=
geoJSONformat
.
writeFeatureObject
(
feature
);
feature
[
"
area
"
]
=
feature
.
getGeometry
().
getArea
();
var
project
=
feature
.
get
(
"
project
"
);
var
name
=
feature
.
get
(
"
name
"
);
feature
[
"
description
"
]
=
project
+
"
>
"
+
name
;
feature
[
"
source
"
]
=
"
CityGML
"
;
var
citygmlHere
;
if
(
fromJavaFX
)
{
citygmlHere
=
fxapp
.
checkIfCityGMLSAreAvailable
(
project
,
name
);
}
feature
[
"
available
"
]
=
citygmlHere
;
});
}
// The features are not added to a regular vector layer/source,
// but to a feature overlay which holds a collection of features.
// This collection is passed to the modify and also the draw
// interaction, so that both can add or modify features.
var
featureOverlay
=
new
ol
.
FeatureOverlay
({
style
:
new
ol
.
style
.
Style
({
fill
:
new
ol
.
style
.
Fill
({
color
:
'
rgba(255, 155, 51, 0.5)
'
}),
stroke
:
new
ol
.
style
.
Stroke
({
color
:
'
#ffcc33
'
,
width
:
4
}),
image
:
new
ol
.
style
.
Circle
({
radius
:
5
,
fill
:
new
ol
.
style
.
Fill
({
color
:
'
#ffcc33
'
})
})
})
});
featureOverlay
.
setMap
(
map
);
var
selected_features
=
featureOverlay
.
getFeatures
();
selected_features
.
on
(
'
add
'
,
function
(
event
)
{
var
feature
=
event
.
element
;
feature
.
on
(
"
change
"
,
function
()
{
displayInfo
();
});
});
var
modify
=
new
ol
.
interaction
.
Modify
({
features
:
featureOverlay
.
getFeatures
(),
// the SHIFT key must be pressed to delete vertices, so
// that new vertices can be drawn at the same position
// of existing vertices
deleteCondition
:
function
(
event
)
{
return
ol
.
events
.
condition
.
shiftKeyOnly
(
event
)
&&
ol
.
events
.
condition
.
singleClick
(
event
);
}
});
map
.
addInteraction
(
modify
);
var
draw
=
new
ol
.
interaction
.
Draw
({
features
:
featureOverlay
.
getFeatures
(),
type
:
'
Polygon
'
});
map
.
addInteraction
(
draw
);
var
sketch
;
var
fromJavaFX
;
draw
.
on
(
'
drawstart
'
,
function
(
evt
)
{
fromJavaFX
=
(
typeof
fxapp
!==
'
undefined
'
);
sketch
=
evt
.
feature
;
reset_btn
.
disabled
=
false
;
updateGMLPolygons
();
});
var
sourceProj
=
map
.
getView
().
getProjection
();
function
findIntersections
()
{
var
sketch_area
=
sketch
.
getGeometry
().
getArea
();
var
poly1
=
geoJSONformat
.
writeFeatureObject
(
sketch
);
var
intersection_found
=
false
;
intersections
.
clear
();
function
findIntersection
(
feature
)
{
try
{
var
jsonIntersection
=
turf
.
intersect
(
poly1
,
feature
[
"
geoJSON
"
]);
if
(
undefined
!==
jsonIntersection
)
{
if
(
!
intersection_found
)
{
dataPanel
.
append
(
"
Intersection found with :<br/>
\n
"
);
intersection_found
=
true
;
}
var
intersection
=
geoJSONformat
.
readFeature
(
jsonIntersection
);
var
intersectionArea
=
intersection
.
getGeometry
().
getArea
();
var
citygml_percentage
=
Math
.
round
(
intersectionArea
/
feature
[
"
area
"
]
*
100
);
var
sketch_percentage
=
Math
.
round
(
intersectionArea
/
sketch_area
*
100
);
intersections
.
addFeature
(
intersection
);
var
description
;
if
(
feature
[
"
available
"
])
{
description
=
"
<a href=
\"
#
\"
onclick=
\"
downloadRegionFrom
"
+
feature
[
"
source
"
]
+
"
(
"
+
i
+
"
);return false;
\"
>
"
+
feature
[
"
description
"
]
+
"
</a>
"
;
// console.log(description);
}
else
{
description
=
feature
[
'
description
'
];
}
dataPanel
.
append
(
description
+
"
(
"
+
citygml_percentage
+
"
%
"
);
if
(
sketch_percentage
==
100
)
{
dataPanel
.
append
(
"
, all inside
"
);
}
dataPanel
.
append
(
"
)<br/>
\n
"
);
}
}
catch
(
err
)
{
console
.
log
(
feature
.
get
(
'
description
'
)
+
"
-
"
+
err
);
}
i
++
;
}
var
i
=
0
;
kml_source
.
forEachFeature
(
findIntersection
);
if
(
!
intersection_found
)
{
dataPanel
.
append
(
"
No intersection found with any CityGML or NovaFactory product<br/>
\n
"
);
}
}
function
downloadRegionFromCityGML
(
i
)
{
// TODO: Disable all links
// TODO: DRY
$
(
"
html
"
).
addClass
(
"
wait
"
);
var
feature
=
kml_source
.
getFeatures
()[
i
];
// Waiting 100ms in order to let the cursor change
setTimeout
(
function
()
{
// var start = new Date().getTime();
fxapp
.
downloadRegionFromCityGML
(
sketchAsWKT
(),
feature
.
get
(
"
project
"
),
feature
.
get
(
"
name
"
));
// var end = new Date().getTime();
// var time = end - start;
// console.log('DL Execution time: ' + time);
setTimeout
(
function
()
{
$
(
"
html
"
).
removeClass
(
"
wait
"
);
dataPanel
.
append
(
"
Done<br/>
\n
"
);
},
100
);
},
100
);
}
function
displayInfo
()
{
// var start = new Date().getTime();
dataPanel
.
empty
();
var
geom
=
/** @type {ol.geom.Polygon} */
(
sketch
.
getGeometry
().
clone
().
transform
(
sourceProj
,
'
EPSG:4326
'
));
var
coordinates
=
geom
.
getLinearRing
(
0
).
getCoordinates
();
var
area
=
Math
.
abs
(
wgs84Sphere
.
geodesicArea
(
coordinates
));
var
coords
=
geom
.
getLinearRing
(
0
).
getCoordinates
();
if
(
!
fromJavaFX
)
{
var
nad83_coords
=
""
;
var
wgs84_coords
=
""
;
var
n
=
coords
.
length
;
for
(
var
i
=
0
;
i
<
n
;
i
++
)
{
var
wgs84_coord
=
coords
[
i
];
// wgs84_coords += "regionPolygon.add(new Coord(" + wgs84_coord[1] +
// "," + wgs84_coord[0] + "));<br/>";
wgs84_coords
+=
"
(
"
+
wgs84_coord
[
1
]
+
"
,
"
+
wgs84_coord
[
0
]
+
"
)<br/>
"
;
var
nad83_coord
=
ol
.
proj
.
transform
(
coords
[
i
],
ol
.
proj
.
get
(
'
EPSG:4326
'
),
ol
.
proj
.
get
(
'
EPSG:32118
'
));
nad83_coords
+=
"
(
"
+
nad83_coord
[
0
]
+
"
,
"
+
nad83_coord
[
1
]
+
"
)<br/>
"
;
}
dataPanel
.
append
(
"
WGS84 Coordinates<br/>
"
);
dataPanel
.
append
(
wgs84_coords
+
"
<br/>
\n
"
);
dataPanel
.
append
(
"
NAD83 Coordinates<br/>
"
);
dataPanel
.
append
(
nad83_coords
+
"
<br/>
\n
"
);
}
dataPanel
.
append
(
"
Area
"
+
"
<br/>
\n
"
);
dataPanel
.
append
((
Math
.
round
(
area
/
1000
)
/
10
).
toString
()
+
"
ha<br/><br/>
\n
"
);
findIntersections
();
// var end = new Date().getTime();
// var time = end - start;
// console.log('Execution time: ' + time);
}
draw
.
on
(
'
drawend
'
,
function
()
{
displayInfo
();
draw
.
setActive
(
false
);
});
$
(
'
#reset
'
).
click
(
function
()
{
try
{
draw
.
finishDrawing
();
}
finally
{
dataPanel
.
empty
();
$
(
"
html
"
).
removeClass
(
"
wait
"
);
draw
.
setActive
(
true
);
featureOverlay
.
getFeatures
().
clear
();
intersections
.
clear
();
reset_btn
.
disabled
=
true
;
focusOnMap
();
}
});
function
sketchAsWKT
(
epsgId
)
{
epsgId
=
(
typeof
epsgId
===
'
undefined
'
)
?
'
32118
'
:
epsgId
;
var
wktFormat
=
new
ol
.
format
.
WKT
();
return
wktFormat
.
writeFeature
(
sketch
,
{
dataProjection
:
ol
.
proj
.
get
(
'
EPSG:
'
+
epsgId
),
featureProjection
:
ol
.
proj
.
get
(
'
EPSG:3857
'
)
});
}
function
focusOnMap
()
{
$
(
'
#map
'
).
focus
();
// $('#map').scrollIntoView();
}
focusOnMap
();
\ No newline at end of file
test/eu/simstadt/regionchooser/test/RegionExtractorTests.java
View file @
a66b863e
...
...
@@ -28,7 +28,8 @@ public void testExtract3BuildingsFromGSK3Model() throws Throwable {
String
wktPolygon
=
"POLYGON((3515848.896028535 5415823.108586172,3515848.9512289143 5415803.590347393,3515829.0815150724 5415803.338023346,3515830.9784850604 5415793.437034622,3515842.0946056456 5415793.272282251,3515843.3515515197 5415766.204935087,3515864.1064344468 5415766.557899496,3515876.489172751 5415805.433782301,3515876.343844858 5415822.009293416,3515848.896028535 5415823.108586172))"
;
Path
repo
=
Paths
.
get
(
"../TestRepository"
);
Path
citygmlPath
=
repo
.
resolve
(
"Gruenbuehl.proj/20140218_Gruenbuehl_LOD2.gml"
);
String
churchGMLString
=
RegionExtractor
.
selectRegionDirectlyFromCityGML
(
citygmlPath
,
wktPolygon
).
toString
();
String
churchGMLString
=
RegionExtractor
.
selectRegionDirectlyFromCityGML
(
citygmlPath
,
wktPolygon
,
"EPSG:31467"
)
.
toString
();
assertEquals
(
countRegexMatches
(
churchGMLString
,
"<(core:)?cityObjectMember"
),
3
);
assertTrue
(
churchGMLString
.
contains
(
"Donaustr"
));
assertTrue
(
churchGMLString
.
contains
(
"DEBW_LOD2_203056"
));
...
...
@@ -42,7 +43,7 @@ public void testExtract3BuildingsFromNAD83Model() throws Throwable {
String
wktPolygon
=
"POLYGON((300259.78663489706 62835.835907766595,300230.33294975647 62792.0482567884,300213.5667431851 62770.83143720031,300183.6592861123 62730.20347659383,300252.9947486632 62676.938468840905,300273.3862256562 62701.767105345614,300257.5250407747 62715.760413539596,300308.2754543957 62805.14198211394,300259.78663489706 62835.835907766595))"
;
Path
repo
=
Paths
.
get
(
"../TestRepository"
);
Path
citygmlPath
=
repo
.
resolve
(
"NewYork.proj/ManhattanSmall.gml"
);
String
archGMLString
=
RegionExtractor
.
selectRegionDirectlyFromCityGML
(
citygmlPath
,
wktPolygon
)
String
archGMLString
=
RegionExtractor
.
selectRegionDirectlyFromCityGML
(
citygmlPath
,
wktPolygon
,
"EPSG:32118"
)
.
toString
();
assertEquals
(
countRegexMatches
(
archGMLString
,
"<(core:)?cityObjectMember"
),
2
);
assertTrue
(
archGMLString
.
contains
(
"WASHINGTON SQUARE"
));
...
...
@@ -56,7 +57,7 @@ public void testExtract0BuildingsWithWrongCoordinates() throws Throwable {
String
wktPolygon
=
"POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))"
;
Path
repo
=
Paths
.
get
(
"../TestRepository"
);
Path
citygmlPath
=
repo
.
resolve
(
"NewYork.proj/ManhattanSmall.gml"
);
String
emptyGMLString
=
RegionExtractor
.
selectRegionDirectlyFromCityGML
(
citygmlPath
,
wktPolygon
)
String
emptyGMLString
=
RegionExtractor
.
selectRegionDirectlyFromCityGML
(
citygmlPath
,
wktPolygon
,
"EPSG:32118"
)
.
toString
();
assertEquals
(
countRegexMatches
(
emptyGMLString
,
"<(core:)?cityObjectMember"
),
0
);
}
...
...
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