A bit more digging NTv2GridShiftFactory fac = new NTv2GridShiftFactory(); URL url = fac.getClass().getResource("shtransntv2.gsb"); System.out.println(fac.isNTv2Grid(url)); GridShiftFile grid = fac.createNTv2Grid(url); System.out.println(grid);
gives Headers : 11 Sub Hdrs : 11 Sub Grids: 1 Type : SECONDS Version : NTv2.0 Fr Ellpsd: DHDN90 To Ellpsd: ETRS89 Fr Maj Ax: 6377397.155 Fr Min Ax: 6356078.963 To Maj Ax: 6378137.0 To Min Ax: 6356752.314 so it looks like that transform will only be used between DHDN geoids ( http://epsg.io/4314-15949) and ETRS89 - so it might work with DHDN / 3-degree Gauss-Kruger zone 3 (E-N) (http://epsg.io/5677) Ian On Wed, 8 Apr 2020 at 13:32, Ian Turton <ijtur...@gmail.com> wrote: > On further investigation at epgs.io I can get a gsb transform for > epsg:31467->epsg:4326 (WGS84) using BETA2007.gsb but not the epsg:4258 > (ETRS) which is the base for EPSG:4647 (ETRS89 / UTM zone 32N (zE-N)). > > I can't find any reference to the need for a grid file for this transform > so that may be why it isn't picked up by the code? Are you sure this > transform is in the EPSG tables? > > Ian > > On Wed, 8 Apr 2020 at 05:55, Benjamin Sokolowski < > benjamin.sokolow...@data-experts.de> wrote: > >> With and without gsb file the same output: >> >> CONCAT_MT[INVERSE_MT[PARAM_MT["Transverse_Mercator", >> PARAMETER["semi_major", 6377397.155], >> PARAMETER["semi_minor", 6356078.962818189], >> PARAMETER["central_meridian", 9.0], >> PARAMETER["latitude_of_origin", 0.0], >> PARAMETER["scale_factor", 1.0], >> PARAMETER["false_easting", 3500000.0], >> PARAMETER["false_northing", 0.0]]], >> PARAM_MT["Ellipsoid_To_Geocentric", >> PARAMETER["dim", 2], >> PARAMETER["semi_major", 6377397.155], >> PARAMETER["semi_minor", 6356078.962818189]], >> PARAM_MT["Affine", >> PARAMETER["num_row", 4], >> PARAMETER["num_col", 4], >> PARAMETER["elt_0_0", 1.00000255], >> PARAMETER["elt_0_1", 0.00001356027323924231], >> PARAMETER["elt_0_2", 0.00000027634450290912], >> PARAMETER["elt_0_3", 612.4], >> PARAMETER["elt_1_0", -0.00001356027323924231], >> PARAMETER["elt_1_1", 1.00000255], >> PARAMETER["elt_1_2", 0.00000026180005538759], >> PARAMETER["elt_1_3", 77.0], >> PARAMETER["elt_2_0", -0.00000027634450290912], >> PARAMETER["elt_2_1", -0.00000026180005538759], >> PARAMETER["elt_2_2", 1.00000255], >> PARAMETER["elt_2_3", 440.2]], >> PARAM_MT["Geocentric_To_Ellipsoid", >> PARAMETER["dim", 2], >> PARAMETER["semi_major", 6378137.0], >> PARAMETER["semi_minor", 6356752.314140356]], >> PARAM_MT["Transverse_Mercator", >> PARAMETER["semi_major", 6378137.0], >> PARAMETER["semi_minor", 6356752.314140356], >> PARAMETER["central_meridian", 9.0], >> PARAMETER["latitude_of_origin", 0.0], >> PARAMETER["scale_factor", 0.9996], >> PARAMETER["false_easting", 32500000.0], >> PARAMETER["false_northing", 0.0]]] >> >> which i think, is the default transformation of geotools. Here's the gsb >> file >> >> >> Benjamin >> >> >> >> Von: "Ian Turton" <ijtur...@gmail.com> >> An: "Benjamin Sokolowski" <benjamin.sokolow...@data-experts.de> >> Kopie: "geotools-users" <geotools-gt2-users@lists.sourceforge.net> >> Datum: 07.04.2020 15:53 >> Betreff: Re: Re: Re: [Geotools-gt2-users] Coordinate >> Transformation >> ------------------------------ >> >> >> >> Can you try this program with and without the GSB file >> >> import org.geotools.referencing.CRS; >> import org.opengis.referencing.FactoryException; >> import org.opengis.referencing.NoSuchAuthorityCodeException; >> import org.opengis.referencing.crs.CoordinateReferenceSystem; >> import org.opengis.referencing.operation.MathTransform; >> >> public class gridShiftTest { >> >> public static void main(String[] args) throws >> NoSuchAuthorityCodeException, FactoryException { >> >> CoordinateReferenceSystem sourceCRS = CRS.decode( "EPSG:31467" ); >> CoordinateReferenceSystem targetCRS = CRS.decode( "EPSG:4647" ); >> MathTransform transform = CRS.findMathTransform(sourceCRS, targetCRS); >> >> System.out.println(transform); >> } >> >> } >> >> Or mail me the gsb file if you can and I'll try - I don't seem to have a >> grid file for this transformation on my system because I've mainly used UK >> and USA ones in the past. >> >> Ian >> >> On Tue, 7 Apr 2020 at 13:21, Benjamin Sokolowski < >> *benjamin.sokolow...@data-experts.de* >> <benjamin.sokolow...@data-experts.de>> wrote: >> Hi Ian, >> >> even with the .gsb in the new folder with your given name, no changes at >> all. Same wrong results. Do you have another idea what i'm missing? The >> "epsg_operations.properties" is not mandatory right? I don't have that >> right now. >> >> Benjamin >> >> >> >> Von: "Ian Turton" <*ijtur...@gmail.com* <ijtur...@gmail.com>> >> An: "Benjamin Sokolowski" <*benjamin.sokolow...@data-experts.de* >> <benjamin.sokolow...@data-experts.de>> >> Kopie: "geotools-users" < >> *geotools-gt2-users@lists.sourceforge.net* >> <geotools-gt2-users@lists.sourceforge.net>> >> Datum: 07.04.2020 11:33 >> Betreff: Re: Re: [Geotools-gt2-users] Coordinate Transformation >> ------------------------------ >> >> >> >> I've never tried adding a gsb file directly to the jar file, I usually >> create the folder >> src/main/resources/org/geotools/referencing/factory/gridshift >> in my project and store the file in there. >> >> Ian >> >> On Tue, 7 Apr 2020 at 10:14, Benjamin Sokolowski < >> *benjamin.sokolow...@data-experts.de* >> <benjamin.sokolow...@data-experts.de>> wrote: >> Hi Ian, >> >> thanks for the reply. Found the discussion at stackexchange already, but >> it didn't help me. Maybe i didn't understand it correctly. >> >> *where exactly did you put it?* >> Do you mean in which jar-File? gt-referencing-16.0.jar >> I only have geotools in the build path, not the sources. >> >> Benjamin >> >> >> >> Von: "Ian Turton" <*ijtur...@gmail.com* <ijtur...@gmail.com>> >> An: "Benjamin Sokolowski" <*benjamin.sokolow...@data-experts.de* >> <benjamin.sokolow...@data-experts.de>> >> Kopie: "geotools-users" < >> *geotools-gt2-users@lists.sourceforge.net* >> <geotools-gt2-users@lists.sourceforge.net>> >> Datum: 07.04.2020 11:06 >> Betreff: Re: [Geotools-gt2-users] Coordinate Transformation >> ------------------------------ >> >> >> >> Have a look at >> *https://gis.stackexchange.com/questions/313512/specifying-epsg-transformation-method-in-geotools/313523#313523* >> <https://gis.stackexchange.com/questions/313512/specifying-epsg-transformation-method-in-geotools/313523#313523> >> for >> an example. >> >> When you say you added the .gsb to >> 'org.geotools.referencing.factory.gridshift' >> where exactly did you put it? >> >> Ian >> >> On Tue, 7 Apr 2020 at 09:33, Benjamin Sokolowski < >> *benjamin.sokolow...@data-experts.de* >> <benjamin.sokolow...@data-experts.de>> wrote: >> Hello, >> >> first time posting. Hope you guys can help. >> I want to transform coordinates (point geometry) from Gauß Krueger Zone 3 >> to ETRS:89 UTM32 using geotools and a grid file, which i already have. How >> exactly do i do this? >> >> I already got the codelines: >> CoordinateReferenceSystem sourceCRS = CRS.*decode*( "EPSG:31467" ); >> CoordinateReferenceSystem targetCRS = CRS.*decode*( "EPSG:4647" ); >> MathTransform transformation = CRS.*findMathTransform*( sourceCRS, >> targetCRS ); >> Geometry result = JTS.*transform*( geometry, transformation ); >> >> and put the .gsb to 'org.geotools.referencing.factory.gridshift', but >> that doesn't seem to work. Geotools is still using the default >> Transformation, not the more precise with the grid file. >> >> Best regards >> Benjamin Sokolowski_______________________________________________ >> GeoTools-GT2-Users mailing list >> *GeoTools-GT2-Users@lists.sourceforge.net* >> <GeoTools-GT2-Users@lists.sourceforge.net> >> *https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users* >> <https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users> >> >> >> -- >> Ian Turton >> >> >> >> -- >> Ian Turton >> >> >> >> -- >> Ian Turton >> >> > > -- > Ian Turton > -- Ian Turton
_______________________________________________ GeoTools-GT2-Users mailing list GeoTools-GT2-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users