go-spatial / tegola

Tegola is a Mapbox Vector Tile server written in Go
http://tegola.io/
MIT License
1.28k stars 196 forks source link

Problem executing custom SQL in GeoPackage #863

Open curtis18 opened 2 years ago

curtis18 commented 2 years ago

Hi there,

Thanks for creating this project. It is found that problem executing custom SQL in GeoPackage. Error: could not register providers: layer 'test_layer' problem executing custom SQL: no such function: ST_Transform. The transform of SRID to 4326 can be run on PostGIS, but not GeoPackagedue due to lacking of PROJ.4 module. Can PROJ.4 be loaded to Tegola for changing the SRID in GeoPackage on the fly?

https://www.gaia-gis.it/gaia-sins/spatialite-sql-4.3.0.html

ARolek commented 2 years ago

@curtis18 what you're running into is the difference between GeoPackage and Spatialite. GeoPackage has a very defined schema but does not come with spatial processing functions. Spatialite does have spatial processing functions, which you're trying to leverage in the GeoPackage implementation. Even though both use SQLite, GeoPackage does not load the Spatialite extension.

There is an open issue from a long time ago around adding Spatialite (#115), it just has never been done. If you want to take a pass at trying to implement it I'm happy to support the effort.