存储嵌入式地图应用程序的图像

发布于 2024-08-21 16:24:22 字数 417 浏览 5 评论 0原文

我有不同分辨率的光栅化地图,其中包含 15K/60K/240K 图片,每个尺寸为 256x256,并且我有可以显示地图的 .NET Compact Framework 应用程序。 但是将300k文件复制到SD卡需要很多时间,大约需要35-60小时(我只复制了15K,花了大约2到2.5小时),而且我担心它会破坏FAT16文件系统(硬件不支持) FAT32,所以我无法将 fat16 切换到 fat32),否则复制所有内容后运行速度会非常慢。

所有图片都这样存储: /mapdata/res{resolution}/x{x_coord}/y{y_coord}.png

任何嵌入式数据库都可以帮助我吗?或者我应该将图像打包成 zip 像 /storage/res1/x12.zip 并存档所有 y*.png 吗?或者我应该用所有这些图片创建 ISO 映像,然后将 ISO 逐字节复制到 SD?

I have rasterized map in different resolutions, which consists of 15K/60K/240K pictures each sized 256x256, and i have .NET Compact Framework application which can display the map.
But it takes a lot of time to copy 300k files to SD card, approximately 35-60 hours (i copyied just 15K and it took ~ 2 to 2.5 hours), and i'm afraid it will ruin FAT16 filesystem (hardware does not support FAT32, so i can't switch fat16 to fat32) or after copying everything will work very slow.

All pictures are stored like this: /mapdata/res{resolution}/x{x_coord}/y{y_coord}.png

Can any embeddable DB help me? Or should i pack images into zip like /storage/res1/x12.zip with all y*.png archived? Or i just should create ISO-image with all these pictures and just copy iso to SD byte-to-byte?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

云雾 2024-08-28 16:24:22

FAT16 仅限于 65,535 个簇,每个文件至少需要一个簇,这将排除仅使用平面文件的可能性。

我假设您的地图图块是只读的,所以我会采取一种为您控制的图块创建自定义文件格式的方法(可能还具有需要更多努力来分解的额外好处,应该它落入错误的手中)。

也许是这样的:

  • 某种标题,这样你就知道这是你的文件。
  • 一个元组,其中包含从文件开头到“零”缩放级别的图块的偏移量及其长度(以字节为单位)
  • 四个元组,用于表示缩放级别“1”的图块的偏移量和长度
  • ...
  • 4^( n) 缩放级别“n”处图块的偏移量和长度的元组
  • 实际图块数据。

查找给定图块的偏移量,并在报告流结束时覆盖流以执行“正确的事情”,这将是相对轻量级的 - 如果您要编码,您甚至可以对“无图块”图片使用相同的偏移量无法完全融入正方形的区域(例如英国)

FAT16 is limited to 65,535 clusters, and a minimum of a single cluster is required per file, which will rule out just using flat files.

I'm assuming your map tiles are to be read-only, so I would take a route of creating a custom file format for your tiles that you control (may also have the added benefit of requiring a bit more effort to take apart, should it fall into the wrong sort of hands).

Maybe something along the lines of:

  • Some kind of header, so you know it's your file.
  • A tuple which contains the offset from the start of the file to the tile for the "zero" zoom level, and it's length in bytes
  • Four tuples for the offsets and lengths for the tiles for zoom level "1"
  • ...
  • 4^(n) tuples for the offsets and lengths for the tiles at zoom level "n"
  • The actual tile data.

It would be relatively lightweight to look up the offsets for a given tile, and override a Stream to do "the right thing" when reporting end of the Stream - you could even use the same offset for "no tile" pictures should you be encoding an area that doesn't fit neatly into a square (like, say, Great Britain)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文