lonboard icon indicating copy to clipboard operation
lonboard copied to clipboard

import parquet-wasm from local bundle rather than CDN

Open cornhundred opened this issue 1 year ago • 8 comments

Hi, is it possible to import parquet-wasm using esbuild rather than a CDN? I see that parquet-wasm is a dependency in the package.json

https://github.com/developmentseed/lonboard/blob/c8cf2e1862fa7cd84af196039b21a97a5f00fd8f/package.json#L5-L20

but lonboard is also referencing a CDN here:

https://github.com/developmentseed/lonboard/blob/c8cf2e1862fa7cd84af196039b21a97a5f00fd8f/src/parquet.ts#L2-L19

I ask because I'm trying to test out lonboard on a service that prevents me from making front-end requests to CDNs (I would have to request the URL be added to an allowlist, but I want to see if I can avoid this by bundling the code with esbuild but I was running into errors when I tried to use the bundled version - https://github.com/kylebarron/parquet-wasm/issues/488).

cornhundred avatar Apr 08 '24 14:04 cornhundred

I agree, this change would be nice. But it's unclear to me how to get a reference to the local URL within Jupyter to the current bundle. I asked in the anywidget discord

kylebarron avatar Apr 08 '24 22:04 kylebarron

Thanks @kylebarron, I was able to find a workaround that might be relevant here https://github.com/kylebarron/parquet-wasm/issues/488#issuecomment-2047904050

cornhundred avatar Apr 10 '24 15:04 cornhundred

Trevor responded on discord that serializing the wasm on the model is probably the best approach

kylebarron avatar Apr 10 '24 15:04 kylebarron

Until #461 gets merged, the easiest way (imho) is to let user specify a different cdn url (e.g. http://localhost:8888/files/). For now, we need to resort to modifying the js bundle.

prusswan avatar Oct 10 '24 18:10 prusswan

What's your use case where you can't use the default CDN?

kylebarron avatar Oct 10 '24 20:10 kylebarron

Offline or standalone usage

On Fri, Oct 11, 2024, 4:47 AM Kyle Barron @.***> wrote:

What's your use case where you can't use the default CDN?

— Reply to this email directly, view it on GitHub https://github.com/developmentseed/lonboard/issues/457#issuecomment-2406009923, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFEBYWBHLNJEADOMVJ4X33Z23RWFAVCNFSM6AAAAABPXMRYFGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMBWGAYDSOJSGM . You are receiving this because you are subscribed to this thread.Message ID: @.***>

prusswan avatar Oct 11 '24 00:10 prusswan

But offline you won't be able to see the base map; does that not matter for you?

kylebarron avatar Oct 11 '24 00:10 kylebarron

But offline you won't be able to see the base map; does that not matter for you?

Usually I have a copy of the tiles for performance/practical reasons - it is faster than getting over the internet, while in other cases I am generating them anyway. If BitmapTileLayer (which already works with locally hosted Jupyter file urls) can be expanded to support/include pmtiles it would be perfect (sounds like it is in the works with #494)

prusswan avatar Oct 11 '24 01:10 prusswan