locationtech / proj4j

Java port of the Proj.4 library for coordinate reprojection
Other
181 stars 71 forks source link

Parsing NTv2 Improvement #99

Closed ea23del closed 1 year ago

ea23del commented 1 year ago

This attends to improve the loading/parsing of nadgrid files, specifically of NTv2 files. By cloning the master branch and use this library I noticed that there is an issue regarding NTv2 files.

Specifically I was converting one point (174.7772114,-41.2887953) from WSG84 to EPSG:27205. I realized that the converted coordinates with the current master branch is a bit different if I compare the final coordinates converted by using the next site: https://epsg.io/transform#s_srs=4326&t_srs=27205&x=174.7772114&y=-41.2887953.

During debbuing I noticed that "grids" value in Datum.java was never set and this value was needed in BasicCoordinateTransform.java ( getTransformType() ). So the fix basically consist in asign this "grids" to Datum.java.

Also you might see a line modified in Grid.java. The reason of this was that the methods: reset()/mark() on gridinfoInit() in Grid.java gives an mark/reset not supported exception, which is solved by wrapping the element inside a BufferedInputStream as you might see.

Please review my changes and if there is anything else let me know, thank you in advanced.

ea23del commented 1 year ago

@pomadchin I would like to ask your opinion about my PR. When you have the time please give it a look 😄

pomadchin commented 1 year ago

Omg @ea23del that is your first contirbution! 🎉 gz and thank you!

ea23del commented 1 year ago

extra ideas for a test case to de

For now only the test I made for this particular case which was about converting this point (174.7772114,-41.2887953) from WSG84 to EPSG:27205 by using this projection: "+proj=tmerc +lat_0=-36.87986527777778 +lon_0=174.7643393611111 +k=0.9999 +x_0=300000 +y_0=700000 +datum=nzgd49 +units=m +towgs84=59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993 +nadgrids=nzgd2kgrid0005.gsb +no_defs".

If something new comes out I will write you 😄. Btw, do you believe it's posible to ask for a new release of PROJ4J ? I'm currently using this library for a project I would like to use it with the NTv2 sup. since the last release 1.2.3 doesn't support it for now.

pomadchin commented 1 year ago

@ea23del could I ask you to add it as a test? I think even ExampleTest may work as a nice place for it.

I'll try releasing it ASAP after merge!

pomadchin commented 1 year ago

@ea23del thank you! I think in the last commit ECA checker is unhappy, it had to be the other email - [at]n****s.com

ea23del commented 1 year ago

@ea23del thank you! I think in the last commit ECA checker is unhappy, it had to be the other email - [at]n****s.com

@pomadchin Thank you very much for answering. Idk know why but I'm having issues by logging in eclipse/eca. I tried after pushing my commit and I faced the issue. Many hours latter (now) I'm trying again and still doesn't work. My user/pass are good, the page just stays the same, doesn't give an error message but also doesn't let me in. Have you faced this issue before?

pomadchin commented 1 year ago

Ha, that's weird; I'll merge your PR I can see that it's properly signed now! Thank you! And GZ with the first contribution!

ea23del commented 1 year ago

'll merge your PR I can see that it's properly si

Thank you very much! We stay in touch!

ea23del commented 1 year ago

Hello @pomadchin , Hope you are doing well ! I would like to kindly ask you, if can we have a new release version that includes all the new changes?

pomadchin commented 1 year ago

@ea23del will do it this week!

pomadchin commented 1 year ago

Shipped to maven central, should be available soon!