jvail/spl.js

ST_Transform throwing error

abenrob opened this issue · 11 comments

Hello !
I'm trying to expand my proposed series on spl.js, and I came across an issue -

When trying to use ST_Transform(), I get Error: ST_Transform exception - PROJ reports "proj_create: no database context specified".

The test SQL: SELECT ST_Buffer(ST_Transform(MakePoint(5.7245, 45.1885,4326),3857), 200);

Is this from the lib, or my src DB, or the sqlite version at Observable, or something else?

https://observablehq.com/d/b250322cbcc02b2f

jvail commented

Hi Adam,

in order to perform transformations you will need to load proj.db. Please take a look at the source here: https://github.com/jvail/spl.js/blob/main/examples/openlayers.html

The problem with proj.db is that it is so big. I hope I can include a minimal proj.db into the build later. For now you need to either download the entire db and add it as an arraybuffer or you try the remote approach as in the example (disadvantage: many, many get requests are fired).

Thanks. Trying it out now. Are there resources for building this? If my examples only need 3857 & 4326, I wonder if I could compile a version only containing those...

Thanks. Trying it out now. Are there resources for building this? If my examples only need 3857 & 4326, I wonder if I could compile a version only containing those...

I'll keep the ticket closed, but any info on where proj.db comes from,and how to build it will be appreciated!

jvail commented

Nice notebook example! I'll add a link to the readme once it is done.

Are there resources for building this? If my examples only need 3857 & 4326, I wonder if I could compile a version only containing those...

The problem (and the solution - I hope) with proj.db on the web is here: OSGeo/PROJ#3022

Nice notebook example! I'll add a link to the readme once it is done.

https://observablehq.com/@abenrob/sqlite-geospatial-buffers

jvail commented

Thanks for the PR & a very nice notebook! Just one thing I noticed (not important): mapbox seems to have an issue updating the canvas. When I move the slider some parts of the previous buffer are still visible.

Hm - what browser/os ? I don't see that effect on mine, but I only test what I use habitually...

jvail commented

Peek 2022-06-28 12-00

I am using the latest FF.

I'm on FF 101.0.1 (64-bit) on OSX 11.6 (20G165) I see a very slight effect like that, moreso on buffer dist change than on marker move. Maybe a very slight debounce could help... I'll keep it in mind!

jvail commented

Just tested in chrome and it is completely smooth - seems it is a FF thing.