I am not very well aquainted with geographic data, but I'm working on a student project, where I have to position points from GPS coordinates around Warsaw on a particular shapefile map. It came with a .PRJ file with WKT like this:


It appears to match EPSG:53004, as creating a transform from the WKT and the code gives the same results. Testing it on epsg.io gave me expected results. For Example (21.062044°, 52.273152°) gives (2341987.98976740, 6842001.69919374) which matches my data. Hovewer, when i try to do this the same in geotools in java, I get (5812509.302119869, 2381184.7122050473). When I Put the coordinates in a reverse order, like in the example, the result is (2341992.4375644685, 6808202.108284715) which is still significantly to the south.

I seek any solution or a different way to do this.

I don't really need the map do display nicely, so if there would be a way to transform the map itself so it matches the GPS data, even with an external program, it would also be a solution.

I used code like this:

import org.geotools.geometry.jts.JTS;
import org.geotools.referencing.CRS;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.GeometryFactory;
import org.locationtech.jts.geom.Point;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.opengis.referencing.operation.MathTransform;

public class Example {
    public static void main(String[] args){
        GeometryFactory gf = new GeometryFactory();
        try {

            CoordinateReferenceSystem outCRS = CRS.decode("EPSG:53004");
            CoordinateReferenceSystem inCRS = CRS.decode("EPSG:4326");
            MathTransform transform = CRS.findMathTransform(inCRS, outCRS, true);
            Point p = gf.createPoint(new Coordinate(52.273152,21.062044));
            Geometry g = JTS.transform(p, transform);

        } catch (Exception e) {

Edit: The code is actually ESRI defined, geotools finds it under EPSG:53004 but it requires gt-epsg-extention plugin loaded.

  • Try loading the prj file directly? – Ian Turton Dec 20 '18 at 17:56
  • I did, it gives exactly the same results. – Miau Dec 20 '18 at 18:01
  • 1
    Using Esri software, I'm getting a mix of your results. 53004 (which is Esri-defined, not EPSG-defined) gives: 2341992.43756, 6842001.69919. My guess is that it might be using a slightly different semimajor axis value for the sphere. – mkennedy Dec 20 '18 at 19:56
  • 1
    for me in GeoTools I get EPSG:53004 not found, if I use the WKT from epsg.io it doesn't parse, and if I use your WKT I get your offset or Bursa Wolf params required if I turn off leniency which may lead to the accuracy. – Ian Turton Dec 21 '18 at 8:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.