Load spatial extension in JavaScript #1621
-
Hello, I am using the following code to instantiate duckdb in JavaScript using duckdb-wasm in a web app. How do I then load the spatial extension?
Thanks, |
Beta Was this translation helpful? Give feedback.
Answered by
parkerziegler
Mar 6, 2024
Replies: 1 comment
-
Hey @kbatchu! You load the spatial extension via await db.query(`
INSTALL spatial;
LOAD spatial;
... // Your SQL query here.
`); For example, to load the spatial extension and read in a remote GeoJSON file, you can do something like this: await db.query(`
INSTALL spatial;
LOAD spatial;
CREATE TABLE tableName as SELECT * FROM 'https://somedomain.com/file.geojson');
`); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
kbatchu
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey @kbatchu! You load the spatial extension via
db.query
. Beneath your code above you can do:For example, to load the spatial extension and read in a remote GeoJSON file, you can do something like this: