Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Eric Duminil
RegionChooser
Commits
3096e1c7
Commit
3096e1c7
authored
2 years ago
by
Eric Duminil
Browse files
Options
Download
Email Patches
Plain Diff
Allow local coordinates
parent
179f69ff
master
develop
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/eu/simstadt/regionchooser/RegionChooserCommandLineInterface.java
+13
-6
...tadt/regionchooser/RegionChooserCommandLineInterface.java
src/main/java/eu/simstadt/regionchooser/RegionChooserUtils.java
+1
-1
...in/java/eu/simstadt/regionchooser/RegionChooserUtils.java
with
14 additions
and
7 deletions
+14
-7
src/main/java/eu/simstadt/regionchooser/RegionChooserCommandLineInterface.java
+
13
-
6
View file @
3096e1c7
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
import
java.nio.file.Paths
;
import
java.nio.file.Paths
;
import
java.util.Scanner
;
import
java.util.Scanner
;
import
java.util.concurrent.Callable
;
import
java.util.concurrent.Callable
;
import
org.osgeo.proj4j.CoordinateReferenceSystem
;
import
picocli.CommandLine
;
import
picocli.CommandLine
;
import
picocli.CommandLine.Command
;
import
picocli.CommandLine.Command
;
import
picocli.CommandLine.Option
;
import
picocli.CommandLine.Option
;
...
@@ -25,7 +26,9 @@ class RegionChooserCommandLineInterface implements Callable<Integer>
...
@@ -25,7 +26,9 @@ class RegionChooserCommandLineInterface implements Callable<Integer>
@Option
(
names
=
{
"-e"
,
"--epsg"
},
description
=
"EPSG id for coordinate reference system"
,
paramLabel
=
"31467"
)
@Option
(
names
=
{
"-e"
,
"--epsg"
},
description
=
"EPSG id for coordinate reference system"
,
paramLabel
=
"31467"
)
Integer
espgId
;
Integer
espgId
;
//TODO: Add possibility to choose wgs84 or local_crs
@Option
(
names
=
{
"-l"
,
"--local"
},
description
=
"Are WKT coordinates in local CRS?"
,
paramLabel
=
"local_coordinates?"
)
boolean
localCoordinates
;
@Option
(
names
=
{
"-w"
,
@Option
(
names
=
{
"-w"
,
"--wkt"
},
description
=
"File containing WKT polygon, or - for stdin"
,
paramLabel
=
"polygon.wkt"
)
"--wkt"
},
description
=
"File containing WKT polygon, or - for stdin"
,
paramLabel
=
"polygon.wkt"
)
...
@@ -33,15 +36,15 @@ class RegionChooserCommandLineInterface implements Callable<Integer>
...
@@ -33,15 +36,15 @@ class RegionChooserCommandLineInterface implements Callable<Integer>
@Override
@Override
public
Integer
call
()
throws
Exception
{
public
Integer
call
()
throws
Exception
{
String
srsName
;
CoordinateReferenceSystem
localCRS
;
if
(
espgId
==
null
)
{
if
(
espgId
==
null
)
{
srsName
=
RegionChooserUtils
.
crsFromCityGMLHeader
(
citygmls
[
0
])
.
toString
()
;
localCRS
=
RegionChooserUtils
.
crsFromCityGMLHeader
(
citygmls
[
0
]);
}
else
{
}
else
{
s
rsName
=
"EPSG:"
+
espgId
;
localCRS
=
RegionChooserUtils
.
crsFromS
rsName
(
"EPSG:"
+
espgId
)
;
}
}
String
wktPolygon
=
"unknown"
;
String
wktPolygon
;
if
(
wktFile
.
equals
(
"-"
))
{
if
(
wktFile
.
equals
(
"-"
))
{
if
(
System
.
in
.
available
()
==
0
)
{
if
(
System
.
in
.
available
()
==
0
)
{
...
@@ -56,9 +59,13 @@ public Integer call() throws Exception {
...
@@ -56,9 +59,13 @@ public Integer call() throws Exception {
}
}
}
}
if
(!
localCoordinates
)
{
// WKT coordinates are in WGS84, so should be first converted to srsName
}
System
.
out
.
println
(
"WKT Polygon : "
+
wktPolygon
);
System
.
out
.
println
(
"WKT Polygon : "
+
wktPolygon
);
StringBuilder
sb
=
RegionExtractor
.
selectRegionDirectlyFromCityGML
(
wktPolygon
,
srsName
,
citygmls
);
StringBuilder
sb
=
RegionExtractor
.
selectRegionDirectlyFromCityGML
(
wktPolygon
,
localCRS
.
toString
()
,
citygmls
);
RegionChooserUtils
.
writeStringBuilderToFile
(
sb
,
outputCityGML
);
RegionChooserUtils
.
writeStringBuilderToFile
(
sb
,
outputCityGML
);
...
...
This diff is collapsed.
Click to expand it.
src/main/java/eu/simstadt/regionchooser/RegionChooserUtils.java
+
1
-
1
View file @
3096e1c7
...
@@ -47,7 +47,7 @@ private RegionChooserUtils() {
...
@@ -47,7 +47,7 @@ private RegionChooserUtils() {
* @param srsName
* @param srsName
* @return CoordinateReferenceSystem
* @return CoordinateReferenceSystem
*/
*/
p
rivate
static
CoordinateReferenceSystem
crsFromSrsName
(
String
srsName
)
{
p
ublic
static
CoordinateReferenceSystem
crsFromSrsName
(
String
srsName
)
{
// EPSG:31467
// EPSG:31467
Pattern
pEPSG
=
Pattern
.
compile
(
"^(EPSG:\\d+)$"
);
Pattern
pEPSG
=
Pattern
.
compile
(
"^(EPSG:\\d+)$"
);
Matcher
mEPSG
=
pEPSG
.
matcher
(
srsName
);
Matcher
mEPSG
=
pEPSG
.
matcher
(
srsName
);
...
...
This diff is collapsed.
Click to expand it.
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
Menu
Explore
Projects
Groups
Snippets