Hello Thierry!
Le 17/10/2019 à 20:06, Thierry Danard a écrit :
I recently started to use Apache SIS. It was fairly easy to learn how
to convert between two coordinate systems. However, my application
requires the precision brought by the use of NADCON and NTV2 grid
shifts. I do see in the logs the following warnings when I perform a
coordinate conversion:
Oct 17, 2019 12:36:32 PM
org.apache.sis.referencing.operation.CoordinateOperationFinder
createOperations
WARNING: Can not parse “NTv2_0.gsb” as a file in the NTv2 format.
(...snip...)
I do have a copy of all .las, .los and .gsb files. My first question
is: where does Apache SIS expect these files to be located?
For data files like datum grids, SIS needs a directory where the data
will be located. This directory can be located anywhere on your machine.
Its location is specified by the SIS_DATA environment variable. On Linux
and MacOS systems, this environment variable can be set on the
command-like as below:
export SIS_DATA=/path/to/a/directory
On Windows systems, I think the command is "set" instead of "export".
The directory pointed by the SIS_DATA environment variable must exist;
SIS will not create it in order to avoid touching the system without
user knowledge. For the same reason, there is currently no default
directory is SIS_DATA is not set.
The ".los", ".las" and ".gsb" can be put in a sub-directory of above
directory with exactly this name (including upper-cases):
DatumChanges/
By the way, SIS can also use this directory for the EPSG dabase
<http://sis.apache.org/epsg.html#maven-epsg>. Using that directory +
sis-epsg Maven artifact is faster than using the sis-embedded-data Maven
artifact. Just having the SIS_DATA variable defined and the sis-epsg
Maven artifact available on the classpath (instead of sis-embedded-data)
is sufficient; SIS will create a local copy of the EPSG database in that
directory automatically.
The org.apache.sis.internal.referencing.provider.NADCON class only
references one grid (the conus grid, defined by conus.los and
conus.las files). How do I add other NADCON grids (ex: alaska) ?
Should I modify the code of the NADCON class to take into account my
other NADCON grid files ?
There is no need to change the code. Just put all files in above-cited
<value of SIS_DATA>/DatumChanges/ directory and it should work. SIS gets
the name of datum shift grid from the EPSG database. In order to
instruct SIS to use the grid for Alaska, use the CRS.findOperation
static method
<http://sis.apache.org/apidocs/org/apache/sis/referencing/CRS.html#findOperation(org.opengis.referencing.crs.CoordinateReferenceSystem,org.opengis.referencing.crs.CoordinateReferenceSystem,org.opengis.metadata.extent.GeographicBoundingBox)>
with the areaOfInterest argument set to a bounding box over Alaska. Same
apply for other regions of the world.
In order to verify if the datum grid files are used, just print the
CoordinateOperation to the console:
System.out.println(theOperation);
Check the PARAMETER elements in the output string. You should see
parameter with the grid file names in it.
Please let us know if there is any issue,
Regards,
Martin