1

I want to transform my EPSG:25833 coordinates to google WGS84 at my android app. After long time searching i found the Coordinate Transformation Suite (abridged CTS) library.

Has anybody a working example

if i try the example from orbisgis i get the error Caused by: java.lang.ClassNotFoundException: Didn't find class "org.slf4j.LoggerFactory" on path:

   CRSFactory cRSFactory = new CRSFactory();

    // Add the appropriate registry to the CRSFactory's registry manager. Here the EPSG registry is used.
    RegistryManager registryManager = cRSFactory.getRegistryManager();
    registryManager.addRegistry(new EPSGRegistry());

    // CTS will read the EPSG registry seeking the 4326 code, when it finds it,
    // it will create a CoordinateReferenceSystem using the parameters found in the registry.
    CoordinateReferenceSystem crs = cRSFactory.getCRS("EPSG:25833");
  //  CoordinateReferenceSystem crs2 = cRSFactory.getCRS("EPSG:4326");


    double[] coord = new double[2];
    coord[0] = 54.321;
    coord[1] = 9.876;


    CoordinateReferenceSystem  crs1 = cRSFactory.getCRS("EPSG:4326");
    CoordinateReferenceSystem  crs2 = cRSFactory.getCRS("EPSG:25832");
    GeodeticCRS sourceGCRS = (GeodeticCRS) crs;
    GeodeticCRS targetGCRS = (GeodeticCRS) crs2;
    List<CoordinateOperation> coortzdOps = CoordinateOperationFactory.createCoordinateOperations(sourceGCRS,targetGCRS);
    if (coortzdOps.size() != 0) {
        for (CoordinateOperation op : coortzdOps) {
            double[] dd  = op.transform(coord);
            for (int i = 0; i < dd.length; i++) {

            }
        }
    }

Error log:

java.lang.NoClassDefFoundError: Failed resolution of: Lorg/slf4j/LoggerFactory; at org.cts.registry.RegistryManager.(RegistryManager.java:40) at org.cts.CRSFactory.(CRSFactory.java:68) at com..transform.trans(transform.java:169) at com..MapGoogle.onMapReady(MapGoogle.java:75) at com.google.android.gms.maps.SupportMapFragment$zza$1.zza(Unknown Source) at com.google.android.gms.maps.internal.zzp$zza.onTransact(Unknown Source) at android.os.Binder.transact(Binder.java:392) at xz.a(:com.google.android.gms.DynamiteModulesB:82) at maps.ad.u$5.run(Unknown Source) at android.os.Handler.handleCallback(Handler.java:815) at android.os.Handler.dispatchMessage(Handler.java:104) at android.os.Looper.loop(Looper.java:207) at android.app.ActivityThread.main(ActivityThread.java:5683) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:749) Caused by: java.lang.ClassNotFoundException: Didn't find class "org.slf4j.LoggerFactory" on path: D

closed as off-topic by user30184, John Powell, Evil Genius, Andre Silva, Mapperz Sep 14 '16 at 17:22

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions relating to general Information Technology, with no clear GIS component, are off-topic here, but can be researched/asked at Stack Overflow (software development), Super User (computing hardware and software) and Database Administrators (relational databases)" – user30184, John Powell, Evil Genius, Andre Silva, Mapperz
If this question can be reworded to fit the rules in the help center, please edit the question.

  • CTS github.com/orbisgis/cts/wiki is used in OpenJUMP and Orbis GIS. Working examples about using the library can be found from the source code of those two open source projects but maybe you are after examples about using CTS on Android. – user30184 Sep 14 '16 at 6:52
  • @user30184 i try to use the orbisgis example but i get the error that he can't find a class – Bukmop Sep 14 '16 at 8:12
  • Do you mean that the message that says that org.slf4j.LoggerFactory can't be found from your path is somehow invalid? – user30184 Sep 14 '16 at 8:21
  • @user30184 i imported org.cts.CRSFactory from the lib. but the exception i get is from org.slf4j.Loggerfactory – Bukmop Sep 14 '16 at 8:27
  • 1
    @SeanBarbeau Thanks. It helps. my library needed an lib from slf4j. Thanks all for help – Bukmop Sep 15 '16 at 5:52

Browse other questions tagged or ask your own question.