1

I think gdal/ogr(/proj4) doesn't recognize epsg:3068 right?

Here is what I tried:

public static void transformSRS(){
        // creating EPSG:4326
        SpatialReference sourceSRS = new SpatialReference();
        sourceSRS.ImportFromEPSG(4326);
        // creating EPSG:3068
        SpatialReference targetSRS = new SpatialReference();
        sourceSRS.ImportFromEPSG(3068);
        // printing both SRS's
        System.out.println(sourceSRS); // does get printed
        System.out.println(targetSRS); // doesn't get printed!?
        // creating a point in EPSG:3068 coordinates 850,-150
        Geometry point = Geometry.CreateFromWkt("POINT(850 -150)");
        // assigning EPSG:3068 to the point so the system knows that it is in EPSG:3068
        point.AssignSpatialReference(sourceSRS);
        // trying to transform it to EPSG:4326 but Exception occurs.
        point.TransformTo(targetSRS);
}

and this is the output (first System.out.println() is working but the second one prints null and than the exception at point.TransformTo(targetSRS) ):

GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0,
        AUTHORITY["EPSG","8901"]],
    UNIT["degree",0.0174532925199433,
        AUTHORITY["EPSG","9122"]],
    AUTHORITY["EPSG","4326"]]

ERROR 6: No translation for an empty SRS to PROJ.4 format is known.
Exception in thread "main" java.lang.RuntimeException: OGR Error: General Error
    at org.gdal.ogr.ogrJNI.Geometry_TransformTo(Native Method)
    at org.gdal.ogr.Geometry.TransformTo(Geometry.java:409)
    at org.geotools.mavenGdal.Test.transformSRS(Test.java:880)
    at org.geotools.mavenGdal.Test.main(Test.java:109)
3

You can test it with gdalsrsinfo http://www.gdal.org/gdalsrsinfo.html

gdalsrsinfo epsg:3068

PROJ.4 : '+proj=cass +lat_0=52.41864827777778 +lon_0=13.62720366666667 +x_0=40000 +y_0=10000 +ellps=bessel +towgs84=598.1,73.7,418.2,0.202,0.045,-2.45
5,6.7 +units=m +no_defs '

OGC WKT :
PROJCS["DHDN / Soldner Berlin",
    GEOGCS["DHDN",
        DATUM["Deutsches_Hauptdreiecksnetz",
            SPHEROID["Bessel 1841",6377397.155,299.1528128,
                AUTHORITY["EPSG","7004"]],
            TOWGS84[598.1,73.7,418.2,0.202,0.045,-2.455,6.7],
            AUTHORITY["EPSG","6314"]],
        PRIMEM["Greenwich",0,
            AUTHORITY["EPSG","8901"]],
        UNIT["degree",0.0174532925199433,
            AUTHORITY["EPSG","9122"]],
        AUTHORITY["EPSG","4314"]],
    PROJECTION["Cassini_Soldner"],
    PARAMETER["latitude_of_origin",52.41864827777778],
    PARAMETER["central_meridian",13.62720366666667],
    PARAMETER["false_easting",40000],
    PARAMETER["false_northing",10000],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AUTHORITY["EPSG","3068"]]

Another test is to convert coordinates with gdaltransform http://www.gdal.org/gdaltransform.html

gdaltransform -s_srs epsg:3068 -t_srs epsg:4326
850 -150
13.0512110820125 52.3246380119762 41.6757647842169

Conclusion: At least my GDAL does recognize EPSG:3068.

  • hmm strange.. what version of gdal do you have? – Selphiron Mar 11 '15 at 19:55
  • 1
    This computer seems to have GDAL-dev installed in January, 2014 which became 1.11. later. Proj4 is version 4.8. – user30184 Mar 11 '15 at 20:04
  • hmm I have version 1.11.1 of gdal.. does gdal or ogr contain proj4? Could it be possible that I dont even have proj4? Or wouldn't `importFromEPSG(4326) work if that was the case? Oh and I should mention that I use the java-bindings – Selphiron Mar 12 '15 at 0:17
  • 1
    I do not know java but you create targetSRS and then you do sourceSRS.ImportFromEPSG(3068);for the second time in your code. Is that OK? – user30184 Mar 12 '15 at 5:52
  • duh... yes that was one mistake and I had another: In my "real" code (this one was just a simplification) I tried to Transform to targetSRS before I assigned the geometry the sourceSRS.. It seems that I was very tired while I did this. Thx for pointing out, that made me check everything again. – Selphiron Mar 12 '15 at 9:40

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.