decrease map file bet decreasing zoom level

168 views
Skip to first unread message

Farhad Kargaran

unread,
Jan 7, 2018, 12:39:44 PM1/7/18
to mapsforge-dev
Hi

I have used osmosis command to convert mymap.pbf to mymap.map for mapsforge-vtm map, currently the map support up to zoom level 20, I want to decrease the file size by setting max zoom level to 17 while converting pbf to map, is it possible?
or is it possible to do it on pbf file itself, then convert it to map file?

Emux

unread,
Jan 7, 2018, 12:53:59 PM1/7/18
to mapsfo...@googlegroups.com
Max zoom level 20 is just a sane default. Can set map limits via Viewport setters, e.g.:
map.viewport.setMaxZoomLevel(...)

Mapsforge map files are vector maps, not fixed raster bitmaps with predefined zoom levels. Can render them from zoom 0 and go beyond 20.

Their size depends primarily on their content.
There are advanced options in map-writer like zoom-interval-conf, but it's not recommended to change them, unless know very much what doing.

Please write library name [Mapsforge or VTM] in topic title.

--
Emux

Farhad Kargaran

unread,
Jan 8, 2018, 2:41:24 AM1/8/18
to mapsforge-dev
so its hard to do it, is it possible to do it (limiting zoom level) while exporting openstreetmap to pbf file? I did not find any documentation about it

Ludwig

unread,
Jan 8, 2018, 3:10:02 AM1/8/18
to mapsfo...@googlegroups.com
What you want to use is the zoom-interval-conf option when creating a map file, see https://github.com/mapsforge/mapsforge/blob/master/docs/Getting-Started-Map-Writer.md

We actually do not store data for every single zoom level, but for ranges, so just changing the highest zoom level to something lower will not make a difference. 

This option requires some experimentation to work effectively. Maybe if you try 8,6,10,12,11,17 you cut out the lowest zoom levels and the highest. 
I have not tried this.

--
You received this message because you are subscribed to the Google Groups "mapsforge-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapsforge-dev+unsubscribe@googlegroups.com.
To post to this group, send email to mapsfo...@googlegroups.com.
Visit this group at https://groups.google.com/group/mapsforge-dev.
To view this discussion on the web visit https://groups.google.com/d/msgid/mapsforge-dev/a926f269-8cb3-45da-a4a0-cff56a041933%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Farhad Kargaran

unread,
Jan 9, 2018, 12:12:30 AM1/9/18
to mapsforge-dev
Thank you, I will try it and tell you the result


On Monday, January 8, 2018 at 11:40:02 AM UTC+3:30, Ludwig wrote:
What you want to use is the zoom-interval-conf option when creating a map file, see https://github.com/mapsforge/mapsforge/blob/master/docs/Getting-Started-Map-Writer.md

We actually do not store data for every single zoom level, but for ranges, so just changing the highest zoom level to something lower will not make a difference. 

This option requires some experimentation to work effectively. Maybe if you try 8,6,10,12,11,17 you cut out the lowest zoom levels and the highest. 
I have not tried this.
On 8 January 2018 at 07:41, Farhad Kargaran <farhad....@gmail.com> wrote:
so its hard to do it, is it possible to do it (limiting zoom level) while exporting openstreetmap to pbf file? I did not find any documentation about it

On Sunday, January 7, 2018 at 9:23:59 PM UTC+3:30, Emux wrote:
Max zoom level 20 is just a sane default. Can set map limits via Viewport setters, e.g.:
map.viewport.setMaxZoomLevel(...)

Mapsforge map files are vector maps, not fixed raster bitmaps with predefined zoom levels. Can render them from zoom 0 and go beyond 20.

Their size depends primarily on their content.
There are advanced options in map-writer like zoom-interval-conf, but it's not recommended to change them, unless know very much what doing.

Please write library name [Mapsforge or VTM] in topic title.

--
Emux

--
You received this message because you are subscribed to the Google Groups "mapsforge-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapsforge-de...@googlegroups.com.

To post to this group, send email to mapsfo...@googlegroups.com.
Visit this group at https://groups.google.com/group/mapsforge-dev.

Farhad Kargaran

unread,
Jan 10, 2018, 3:26:14 AM1/10/18
to mapsforge-dev
I try what you said, just 2 or 3 megabyte effect :( I think I sould find a way to generate pbf file with lower zoom level


On Monday, January 8, 2018 at 11:40:02 AM UTC+3:30, Ludwig wrote:
What you want to use is the zoom-interval-conf option when creating a map file, see https://github.com/mapsforge/mapsforge/blob/master/docs/Getting-Started-Map-Writer.md

We actually do not store data for every single zoom level, but for ranges, so just changing the highest zoom level to something lower will not make a difference. 

This option requires some experimentation to work effectively. Maybe if you try 8,6,10,12,11,17 you cut out the lowest zoom levels and the highest. 
I have not tried this.
On 8 January 2018 at 07:41, Farhad Kargaran <farhad....@gmail.com> wrote:
so its hard to do it, is it possible to do it (limiting zoom level) while exporting openstreetmap to pbf file? I did not find any documentation about it

On Sunday, January 7, 2018 at 9:23:59 PM UTC+3:30, Emux wrote:
Max zoom level 20 is just a sane default. Can set map limits via Viewport setters, e.g.:
map.viewport.setMaxZoomLevel(...)

Mapsforge map files are vector maps, not fixed raster bitmaps with predefined zoom levels. Can render them from zoom 0 and go beyond 20.

Their size depends primarily on their content.
There are advanced options in map-writer like zoom-interval-conf, but it's not recommended to change them, unless know very much what doing.

Please write library name [Mapsforge or VTM] in topic title.

--
Emux

--
You received this message because you are subscribed to the Google Groups "mapsforge-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapsforge-de...@googlegroups.com.

To post to this group, send email to mapsfo...@googlegroups.com.
Visit this group at https://groups.google.com/group/mapsforge-dev.

Emux

unread,
Jan 10, 2018, 3:33:36 AM1/10/18
to mapsfo...@googlegroups.com
Map writer stores data simplified for the first 2 default zoom intervals [5,0,7] and [10,8,11] and with full detail for the final [14,12,21] zoom interval.

Can play also with simplification factor or its max zoom.

BTW .pbf files contain the data, not zooms.

--
Emux

Ludwig

unread,
Jan 10, 2018, 5:31:24 AM1/10/18
to mapsfo...@googlegroups.com
If you are keen on a smaller file, another option is to reduce the number of features that are included in the map, by supplying a custom tag-mapping.xml file. 

Buildings, forests, etc polygons take up a lot of space without being truly useful if you are just looking for a street map. 

--
You received this message because you are subscribed to the Google Groups "mapsforge-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapsforge-dev+unsubscribe@googlegroups.com.

To post to this group, send email to mapsfo...@googlegroups.com.
Visit this group at https://groups.google.com/group/mapsforge-dev.
Reply all
Reply to author
Forward
0 new messages