aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2021-04-10 17:15:51 +0200
committerEven Rouault <even.rouault@spatialys.com>2021-04-10 19:17:39 +0200
commit76d8cb9dafd274df537b87be068db282af8d17d7 (patch)
treee3c8b70e5de90542696f9f42a880d7065e8f657b /src
parent35a9ffc2d147c04c3a58c48f16d7c748271e5003 (diff)
downloadPROJ-76d8cb9dafd274df537b87be068db282af8d17d7.tar.gz
PROJ-76d8cb9dafd274df537b87be068db282af8d17d7.zip
createFromUserInput(): add support for (legacy) urn:opengis:crs:EPSG:0:XXXX syntax
Diffstat (limited to 'src')
-rw-r--r--src/iso19111/io.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/iso19111/io.cpp b/src/iso19111/io.cpp
index 2d31fd59..ffd78653 100644
--- a/src/iso19111/io.cpp
+++ b/src/iso19111/io.cpp
@@ -6485,7 +6485,7 @@ static BaseObjectNNPtr createFromUserInput(const std::string &text,
}
// urn:ogc:def:crs:EPSG::4326
- if (tokens.size() == 7) {
+ if (tokens.size() == 7 && tokens[0] == "urn") {
if (!dbContext) {
throw ParsingException("no database context specified");
}
@@ -6514,6 +6514,22 @@ static BaseObjectNNPtr createFromUserInput(const std::string &text,
throw ParsingException(concat("unhandled object type: ", type));
}
+ // Legacy urn:opengis:crs:EPSG:0:4326 (note the missing def: compared to
+ // above)
+ if (tokens.size() == 6 && tokens[0] == "urn") {
+ if (!dbContext) {
+ throw ParsingException("no database context specified");
+ }
+ const auto &type = tokens[2];
+ auto factory =
+ AuthorityFactory::create(NN_NO_CHECK(dbContext), tokens[3]);
+ const auto &code = tokens[5];
+ if (type == "crs") {
+ return factory->createCoordinateReferenceSystem(code);
+ }
+ throw ParsingException(concat("unhandled object type: ", type));
+ }
+
if (dbContext) {
auto factory =
AuthorityFactory::create(NN_NO_CHECK(dbContext), std::string());