Open samodadela opened 3 years ago
The transformation you need is not yet supported. You should have received some sort of error, rather than an incorrect answer. And I really should have documented what works. Sorry, about that.
This package is very much a work in progress, with currently only the lambert72 (I work in Belgium), WGS84 and Web Mercator supported.
If you can wait a bit, I can try to add the UTM transformation
Sure, I can wait and thank you very much for your help. I really couldn't have figured it out myself - stepping through the code it seemed like it was trying to do the conversion.
@maesenka i would need a UTM tranformer too. Can you give me some hints how I could add one? Edit: Looks like org.geotools support the transformation and can be used in combination with geolatte
The model for projection systems is based on the EPSG database. It has a lot of good documentation in the Guidance notes on how to implement coordinate operations, transformations, etc.
For UTM you need to implement a org.geolatte.geom.crs.trans.CoordinateOperation
for Transverse Mercator in the package o.g.g.crs.trans.projections
.
For an example see the LambertConformalConic2SP
implementation, and its unit test LambertCC2SPTest
. The test cases come either from the EPSG database, or are generated using the st_transform() function in Postgis.
I'm trying to convert some (C2D, cartesian, northing/easting) coordinates from EPSG:32634 to EPSG:4326 (G2D, geographic, long/lat). Here's the test I took for reference:
This test coverts from 31370 to 4326 and works as expected.
I modified the test to take in 32634 instead of 31370 and changed the in coordinates:
Of course the values in the assertEquals are wrong for my case... When I run the test, though, I get this error: org.opentest4j.AssertionFailedError: Expected :5.77620918429282 Actual :500000.0
Which means that operation.forward() converted in[0] to 500000.0 - it just copied in[0] to out[0]... and out should be specified in degrees (lat/long).
I'm probably doing something wrong.. but can't spot the problem.
I tried this with geolatte-geom 1.6.0 and 1.8.0.