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
d1a66008
Commit
d1a66008
authored
Jul 21, 2026
by
Eric Duminil
Browse files
Short CRS Format
parent
628c7622
Pipeline
#12425
passed with stage
in 1 minute and 3 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/eu/simstadt/regionchooser/RegionChooserUtils.java
View file @
d1a66008
...
@@ -60,7 +60,9 @@ public static CoordinateReferenceSystem crsFromSrsName(String srsName) {
...
@@ -60,7 +60,9 @@ public static CoordinateReferenceSystem crsFromSrsName(String srsName) {
// urn:ogc:def:crs,crs:EPSG:6.12:31467,crs:EPSG:6.12:5783
// urn:ogc:def:crs,crs:EPSG:6.12:31467,crs:EPSG:6.12:5783
// or
// or
// urn:ogc:def:crs,crs:EPSG::28992
// urn:ogc:def:crs,crs:EPSG::28992
Pattern
pOGC
=
Pattern
.
compile
(
"urn:ogc:def:crs(?:,crs)?:EPSG:[\\d\\.]*:([\\d]+)\\D*"
);
// or short form used by some German (NRW/ALKIS) CityGMLs:
// crs:EPSG::25832
Pattern
pOGC
=
Pattern
.
compile
(
"(?:urn:ogc:def:)?crs(?:,crs)?:EPSG:[\\d\\.]*:([\\d]+)\\D*"
);
Matcher
mOGC
=
pOGC
.
matcher
(
srsName
);
Matcher
mOGC
=
pOGC
.
matcher
(
srsName
);
if
(
mOGC
.
find
())
{
if
(
mOGC
.
find
())
{
return
CRS_FACTORY
.
createFromName
(
EPSG
+
mOGC
.
group
(
1
));
return
CRS_FACTORY
.
createFromName
(
EPSG
+
mOGC
.
group
(
1
));
...
...
src/test/java/eu/simstadt/regionchooser/CRSfromCityGMLHeaderTests.java
View file @
d1a66008
...
@@ -48,6 +48,12 @@ void testExtractCRSFromValladolid() throws IOException {
...
@@ -48,6 +48,12 @@ void testExtractCRSFromValladolid() throws IOException {
testExtractCSRNameFromHeader
(
repo
.
resolve
(
"Others.proj/Valladolid_Spain_only_header.gml"
),
"EPSG:25830"
);
testExtractCSRNameFromHeader
(
repo
.
resolve
(
"Others.proj/Valladolid_Spain_only_header.gml"
),
"EPSG:25830"
);
}
}
@Test
void
testExtractCRSFromShortOgcCrsFormat
()
{
// e.g. NRW/ALKIS CityGMLs use "crs:EPSG::25832" instead of the full "urn:ogc:def:crs:EPSG::25832"
assertEquals
(
"EPSG:25832"
,
RegionChooserUtils
.
crsFromSrsName
(
"crs:EPSG::25832"
).
toString
());
}
@Test
@Test
void
testDontExtractCRSFromBrokenCityGML
()
throws
IOException
{
void
testDontExtractCRSFromBrokenCityGML
()
throws
IOException
{
Path
citygmlPath
=
repo
.
resolve
(
"Others.proj/SimpleSolid_MSBS.gml"
);
Path
citygmlPath
=
repo
.
resolve
(
"Others.proj/SimpleSolid_MSBS.gml"
);
...
...
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