I have a very specific problem. I am trying to build an offline map on leaflet, rhomobile(based on ruby) and OSM data. The problem is that I am making now a offline layer images folder with the city data rendered and in average a big city is 200mb . In case that OSM data file is only 5mb .

What is the optimal way to do it less? Maybe geojson or something else?

I know for Tilemill you can export data to .mbtiles which is sqlite3 database, but the weight of the file is the same and even bigger ... What you would suggest?

  • Do you need the performance provided by pre-rendered tiles or can you live with rendering on request? – underdark Jan 3 '13 at 22:12
  • both is OK. But I need to reduce my App size on device from 200mb to something like 50mb at least – MR.GEWA Jan 3 '13 at 23:28

If you are looking to cut down the size of your map data there are in general 3 things you can do:

  1. Generalize the geometries (i.e. removed nodes of lines/polygons. The Douglas-Peucker algorithm is a good bet here, used in PostGIS: http://postgis.org/docs/ST_Simplify.html)
  2. Remove attributes of your data (I'm not sure how much the attributes on OSM-data contributes to the size, but in some cases the attribute data can outnumber the actual geographical data, worth looking into)
  3. Choose a file-format that is less verbose. As a general rule, binary formats use less space than text-bases ones. For ultimate compression, take a look at TinyWKB (http://blog.jordogskog.no/2013/04/09/tiny-wkb/). If you want a text-based format I think TopoJSON is worth considering (https://github.com/mbostock/topojson/wiki)
| improve this answer | |

You will need to create a data format that is suitable for what you are trying to do. The data format would compress the data, and generally be optimised for what you are trying to do.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.