Commit d1a66008 authored by Eric Duminil's avatar Eric Duminil
Browse files

Short CRS Format

parent 628c7622
Pipeline #12425 passed with stage
in 1 minute and 3 seconds
......@@ -60,7 +60,9 @@ public static CoordinateReferenceSystem crsFromSrsName(String srsName) {
// urn:ogc:def:crs,crs:EPSG:6.12:31467,crs:EPSG:6.12:5783
// or
// 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);
if (mOGC.find()) {
return CRS_FACTORY.createFromName(EPSG + mOGC.group(1));
......
......@@ -48,6 +48,12 @@ void testExtractCRSFromValladolid() throws IOException {
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
void testDontExtractCRSFromBrokenCityGML() throws IOException {
Path citygmlPath = repo.resolve("Others.proj/SimpleSolid_MSBS.gml");
......
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