I am using Spatialite version as following: SPATIALITE_VERSION: 5.0.0-beta1 PROJ4_VERSION: Rel. 6.1.1 I am running the SpatiaLite transform function in the android studio and it returns a null value during running. I did this command in SpatiaLite GUI and the result was correct. I did another SpatiaLite command in the Android Studio and there was no error. I think the Transform function of SpatiaLite is not recognized in the Android Studio. This is one part of the code that gets a null value in Android Studio: String query="select AsText(Transform(Makepoint(37.253453454,38.253453454,4326),32632));" complete function that I used from spatialite tutorial is as follows:

              public String doSimpleTransform() {
              StringBuilder sb = new StringBuilder();
              sb.append("Coordinate transformation...\n");
              String query="select                                  
         sb.append("Execute query: ").append(query).append("\n");
              try {
         Stmt stmt = db.prepare(query);
         if (stmt.step()) {
             String pointStr = stmt.column_string(0);
            } catch (Exception e) {
         return sb.toString();

This is a command in Spatialite-GUI that return correct value: SELECT AsText(Transform(Makepoint(37.253453454,38.253453454,4326),32632))

  • Do you have SpatiaLite available? What do you get with select spatialite_version();? – user30184 Aug 13 '20 at 11:57
  • I am using Spatialite version as following: SPATIALITE_VERSION: 5.0.0-beta1 PROJ4_VERSION: Rel. 6.1.1 I – user168505 Aug 14 '20 at 5:58
  • Perhaps there is some problem with finding the projection parameters for Transform. Proj 6 has them in a SQLite database named proj.db. – user30184 Aug 14 '20 at 6:54
  • I prepared a database in Spatialite GUI desktop version and then copy this database in android and used tutorial code for an android studio. Do you think is there a missing library? Because I used a library such as a tutorial and about another function, there was no problem. But transform has a problem and is not defined. I checked the command in Spatialite GUI and even tried another Spatiallite GUI but the problem is not solved. I checked the transformation command on websites but the command is true. – user168505 Aug 14 '20 at 10:15
  • Please read gaia-gis.it/fossil/libspatialite/wiki?name=PROJ.6 if it happens to help. – user30184 Aug 14 '20 at 10:23

I changed the code and add new parameter using transform.Using the following code solved the error: query="SELECT AsText ( ST_Transform( MakePoint( 37.253453454 ,38.253453454, 4326 ) , 32632, NULL,(SELECT srtext FROM spatial_ref_sys WHERE srid = 4326),(SELECT srtext FROM spatial_ref_sys WHERE srid = 32632)));";

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.