Android Question Possible bug with warwound Spatialite Library

synasir

Member
Licensed User
Longtime User
Hi Martin,

I am using your Spatialite Library from http://b4a.martinpearman.co.uk/spatialite/ (Spatialite_library_files_v2.20.zip).

I think that there might be a bug in your library.

Here are my steps.

1. Downloaded spatialite_gui-NG-5.0.0-win-amd64.7z from https://www.gaia-gis.it/gaia-sins/windows-bin-amd64-latest/
2. Created a new sqlite db file which populated the spatial_ref_sys table.
3. Tested several WGS84 conversions using the spatialite_gui app.

SELECT ST_AsText(ST_Transform(ST_GeomFromText('POINT(102.169998 3.405541)', 4326),3375))

POINT(463822.411401 376746.015235)


SELECT ST_AsText(ST_Transform(ST_GeomFromText('POINT(112.960079 1.984808)', 4326),3376))

POINT(364271.879307 219602.859137)


SELECT ST_AsText(ST_Transform(ST_GeomFromText('POINT(102.169998 3.405541)', 4326),3168)

POINT(464016.543346 376740.098876)

All are correct according to EPSG.IO.

Ran the scripts again in B4A.

The 4326 to 3375 and 3376 conversions are correct.

File.Copy(File.DirAssets,"db.sqlite", File.DirInternal, "db.sqlite")
Dim DBCon As Spatialite_Database
Dim DBRec As Spatialite_TableResult
Dim sqlcostanti As Spatialite_Constants
DBCon.Initialize()
DBCon.Open(File.DirInternal, "db.sqlite", sqlcostanti.SQLITE_OPEN_READONLY)


DBRec = DBCon.GetTable("SELECT ST_AsText(ST_Transform(ST_GeomFromText('POINT(102.169998 3.405541)', 4326),3168))")
Log(DBRec.Rows(0,0))

However for the 4326 to 3168 conversions, I got this

POINT(463847.87424 376717.570411) - Incorrect

as compared to

POINT(464016.543346 376740.098876) - Correct


Also for your information, if I were to reverse the conversion from 3168 back to 4326 using the incorrect output, the WGS84 coordinate is correct.

Thanks for your time and effort for the great library.
 
Last edited:
Top