Identify grid shift use in CoordinateOperation #112
-
|
Hello, Is there any reliable and generic - i.e., not implementation specific - way to identify if a coordinate operation actually makes use of a grid shift file (NTv2 and otherwise)? I would like to programmatically inspect this using a CoordinateOperation object (or any other means provided by GeoAPI), but am not sure how to do it in a generic way. One idea could be to inspect the WKT of the operation, e.g. if PARAMETERFILE occurred in there, but a test transforming NAD 27 to NAD 83 with the NTv2-file from NRCAN with GeoAPI 3.0.2 and Apache SIS results in the WKT not containing that keyword. Any idea? Any help would be greatly appreciated. Best regards, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
Hello Johannes! Yes it is possible. Given a
On each boolean isNTv2(SingleOperation operation) {
for (ReferenceIdentifier identifier : operation.getMethod().getIdentifiers()) {
if ("EPSG".equalsIgnoreCase(identifier.getCodeSpace())) {
int code = Integer.parseInt(identifier.getCode());
if (code == 9615) { // NTv2
return true;
}
}
}
return false;
}An inconvenient of this approach is that it recognizes only operations defined by EPSG. An alternative is to iterate over the parameters and search for a parameter which is a file. For example: boolean useUriParameter(SingleOperation operation) {
for (GeneralParameterValue parameter : operation.getParameterValues().values()) {
if (parameter instanceof ParameterValue<?> pv) {
Object value = pv.getValue();
if (value instanceof URI) {
return true;
}
}
}
return false;
}An inconvenient of this approach is that it will return |
Beta Was this translation helpful? Give feedback.
Hello Johannes! Yes it is possible. Given a
CoordinateOperation, first there is a choice:ConcatenatedOperation, invoke getOperations() and apply the following checks on all elements.PassThroughOperation, invokegetOperation()and apply the following check on the return value. This is relevant mostly for 3- or 4-dimensional CRS. This check can be ignored if only two-dimensional operations are expected.SingleOperation, then apply the following checks.On each
SingleOperation, we can do one of the following checks, at your choice. A first possibility is to invoke getMethod(), then in…