Comments (4)
Maybe same issue as in other projects
OSGeo/PROJ#233
from proj4j.
I’ve also encountered problems with EPSG:5514. I am not so experienced in this field, so I might be wrong and the problem might lie in my code, but I’ve checked other two tools and the result is different than result from Proj4J.
I need to convert from EPSG:4326 to EPSG:5514. According to page https://epsg.io/5514, coordinates should be negative. Using the transform tool on the same page, https://epsg.io/transform#s_srs=4326&t_srs=5514&x=16.6000000&y=49.1900000, I got negative numbers -598803.96 and -1161258.17.
Using the cs2cs
command line tool, Rel. 6.3.1, February 10th, 2020, I got result with negative numbers:
~ echo 16.606451133 49.193040494 | cs2cs +init=epsg:4326 +to +init=epsg:5514
-598298.71 -1160969.65 0.00
(installed as deb package, https://proj.org/install.html#debian)
However, Proj4J gives different results. This is test code and log output is below.
import org.junit.Before;
import org.junit.Test;
import org.locationtech.proj4j.CRSFactory;
import org.locationtech.proj4j.CoordinateTransform;
import org.locationtech.proj4j.CoordinateTransformFactory;
import org.locationtech.proj4j.ProjCoordinate;
import static org.junit.Assert.assertEquals;
public class TransformTest {
private ProjCoordinate toCoordinate;
@Before
public void doTransform() {
final String coordinateSystemFrom = "epsg:4326";
final String coordinateSystemTo = "epsg:5514";
CoordinateTransformFactory coordinateTransformFactory = new CoordinateTransformFactory();
CRSFactory csFactory = new CRSFactory();
CoordinateTransform transform = coordinateTransformFactory.createTransform(
csFactory.createFromName(coordinateSystemFrom),
csFactory.createFromName(coordinateSystemTo)
);
ProjCoordinate fromCoordinate = new ProjCoordinate(16.6064512, 49.1930405);
toCoordinate = new ProjCoordinate();
transform.transform(fromCoordinate, toCoordinate);
}
@Test
public void test_x() {
assertEquals(-598298.71, toCoordinate.x, 1);
}
@Test
public void test_y() {
assertEquals(-1160969.65, toCoordinate.y, 1);
}
}
From the log:
java.lang.AssertionError:
Expected :-598298.71
Actual :598300.1459260784
java.lang.AssertionError:
Expected :-1160969.65
Actual :1160972.570532075
from proj4j.
The abovementioned test is working if I use this as a second parameter for coordinateTransformFactory.createTransform
:
String paramStr = "+proj=krovak +lat_0=49.5 +lon_0=24.83333333333333 " +
"+alpha=30.28813972222222 +k=0.9999 +x_0=0 +y_0=0 +ellps=bessel +pm=greenwich" +
"+units=m +no_defs +towgs84=570.8,85.7,462.8,4.998,1.587,5.261,3.56 +axis=wsu";
CoordinateTransform transform = coordinateTransformFactory.createTransform(
csFactory.createFromName(coordinateSystemFrom),
csFactory.createFromParameters("5514", paramStr)
);
This param string is copied from comment OSGeo/PROJ#233 (comment) and +axis=wsu
is used, as OSGeo/PROJ#233 (comment) suggested. The value wsu
is taken from the proj documentation https://proj.org/usage/projections.html#axis-orientation.
After this change these two tests are passing.
However, I am not sure if the fix can be ‘so easy’. As I stated in my previous comment, I am quite new in this field without solid knowledge (I am not deeply involved into GIS, I just need to do some simple transformations in my application) and I might overlook some unwanted side effects.
from proj4j.
And by the way, I am using Proj4J version 1.1.1.
from proj4j.
Related Issues (20)
- How I can use vunits in android? HOT 1
- Will there be support for +geoidgrids ? its commonly used for height transformation HOT 1
- VN2000 Error Exception in thread "main" java.lang.IllegalStateException: Latitude is out of range: 9738.514891355962
- Transforming from "EPSG:4326" to "EPSG:3857" results in precision error
- Reprojection results seem to be too imprecise
- Support for polar stereographic with alternate scales HOT 4
- altitude not working when Projecting HOT 1
- rhealpix is not supported HOT 1
- Datum.isEqual maybe have a bug
- Unknown projection: longlat HOT 22
- gtx files cannot be used?
- reprojection from epsg:31370 to epsg:3857 is inaccurate HOT 1
- Transverse Mercator Projection test failed HOT 1
- Equidistant Azimuthal (ESRI:54032) test failed HOT 1
- Robinson projection (ESRI:54030) test failed HOT 2
- UnknownAuthorityCodeException: EPSG:9054 HOT 3
- ntv2 grid support
- Proj4j should not use the Apache License if it contains the EPSG data set HOT 16
- In release 1.2.0, the pom file contains incorrect version '1.2.0-SNAPSHOT' HOT 14
- Improve proj4j tests to reflect the recent changes and the moved out EPSG resources
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from proj4j.