No, that's probably not the issue. I have tried it and it didn't help.
This throws the same exception:

  File gridFile = new File("C:\\Dev\\VTS\\Grids\\WA\\wohpgn.gsb");
  URL url = URLs.fileToUrl(gridFile);
  NTv2Transform transform = new NTv2Transform(url.toURI());

S.

2018-07-25 10:15 GMT+02:00 Ian Turton <[email protected]>:

> I'm not sure if this is the issue but the preferred way to change a file
> into an url is to use the Urls.toUrl method.
>
> Ian
>
> On Tue, 24 Jul 2018, 21:46 Stanislav Dušek, <[email protected]>
> wrote:
>
>> Hello,
>>
>> I'm trying to use GeoTools to calculate the grid coverage based on NTv2
>> .gsb file.
>> However, I'm unable to create the instance of NTv2Transform.
>> When I use this piece of code:
>>
>>     File gridFile = new File("C:\\Dev\\VTS\\Grids\\WA\\wohpgn.gsb");
>>     NTv2Transform transform = new NTv2Transform(gridFile.toURI());
>>
>> I get this exception:
>>
>>     Exception in thread "main" 
>> org.opengis.referencing.NoSuchIdentifierException:
>> Could not locate NTv2 Grid File file:/C:/Dev/VTS/Grids/WA/wohpgn.gsb
>>         at org.geotools.referencing.operation.transform.
>> NTv2Transform.<init>(NTv2Transform.java:105)
>>         at com.frequentis.example.Main.transformFromNad27UsingGrid(
>> Main.java:75)
>>         at com.frequentis.example.Main.main(Main.java:90)
>>
>> Am I using the syntax properly?
>> Is there some other way of how to achieve that?
>> Do you know about some workaround?
>>
>> Btw, I was trying it with versions 18.4 and 19.1 with Maven.
>>
>> Thank you,
>> Stanislav
>> ------------------------------------------------------------
>> ------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot______
>> _________________________________________
>> GeoTools-GT2-Users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to