We are building a project based on a small piece of map , but since all customers load the same map , we need to be cached for faster load . is there a quick way ? or maybe work with redis?
Hi,
Cache where? Cache in the browser? In the app? In an environment/network?
If I understand you correctly, the way to do this in an app is to have the app also be able to serve imagery data (as a webserver, possibly local file system but I’m not sure it’s as easy), the rest is really using an imagery library to serve pieces asked for. It’s not too hard but you need to tile it first, meaning cut your ortho Map into hundreds of smaller pieces at different zoom levels, lots of tools out there for this. Then serve those pieces through something like the generic ImageryLayer drivers in Cesium where you specify a URL template (that has things like base URL [which will be to the device the app runs on], and {z} zoom level and {x} and {y} tile grid coordinates for whatever format the tiles are in (jpg for high-contrast, but often png/gif for maps, etc.).
I’d start here;
https://cesium.com/learn/cesiumjs/ref-doc/UrlTemplateImageryProvider.html
More specific help needs a bit more specifics around the app environment and tools, like languages, serving platforms, etc. But the simple answer is yes, probably.
Cheers,
Alex
As a follow-up with some further thoughts; not sure you need to worry about maps outside of a given area or not (for example, you can serve your locally cached map for the map area, but if they zoom out or away, use a streaming map for those parts, etc.), but there are things you can do to serve your cached map for certain zoom levels, for example, by checking distance between the camera and the globe (or digging into the ImageryProvider drivers), and switch layers on and off which have cached/local versions, global internet versions, etc. or even different cached versions of the data. But the key is the ability to serve a large (ish) tree-structure of folders back to the browser (I’m assuming your app displays Cesium in a browser container? That’s where a webserver is easier than a local file server), everything else follows from that.
Of course, a lot of this comes down to what you mean by “small piece of map”, as when you tile a map you’re tiling for different zoom resolutions, so the size of your total tiles is often a magnitude larger than the original ortho/map, but that’s just the nature of the game. If your original map is 10Mb, prepare to host it as 30Mb, and so on. Compression of tiles is often the key, so which format to serve the tiles in, and at what quality, and what sort of data is in it (satellite earth imagery is harder to compress than, say, a flat drawn map). And it gets more complicated if you also want to render labels in your tiles, then you need smarter software than just tiling an ortho (where you tile different zoom levels and adjust labels and positions at those levels, etc.)
Anyway, let us know some more parameters of your project, otherwise I could write a small novel’s worth of stuff that’s completely pointless.
Cheers,
Alex