views:

35

answers:

1

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?

+1  A: 

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)

Rowland Shaw
this idea has not crossed my mind. looks like a solution. thank you!
poiuyttr