Displaying map from a local file?

Hi,
I how can I implement a functionality of “Load map from filesystem”, in which the user will be able to select a local file, such as (but does not have to be) a GeoTIFF file.

I have encountered the following library, which has a video of what appears to be loading files from the local storage, but without source code, so I assume it to be possible:

Thank you

P.S. If using something like Electron to pass the data is needed, it works for me as well.

Hi there,

I think it depends on the data, but you’ll likely need to upload it to a server to process and host the data.

Using Cesium ion may be a plausible solution if the uploaded file format is supported.

Thanks!
Gabby

Loading from the local filesystem is likely to be seriously impeded by the browser security model – they’re really trying to avoid giving the browser access to more than one file at a time, or letting the page continue to access a file after a page reload, etc. You’re definitely better off running a web server locally (with appropriate CORS headers as needed). I haven’t used this setup myself, but I’ve heard good things about Mapbox, or Maptiler Tileserver, just as an example.

Broadly speaking, you want to convert your data to a format Cesium supports natively, like WM(T)S or the standard tiled imagery schema. It’s an extra step but it’s going to be much easier to support in the long run.

1 Like

Hello @hechtV

We’ve created an open source local viewer which uses CesiumJS. You can take a look at that code and hopefully it helps you out.