Optimizing maps download with "Portable Basemap Server"

Started by yip, May 08, 2015, 04:09:41 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

yip

PBS, Portable Basemap Server is a software introduced by its author 2 years ago, on the oruxmaps forums :

http://oruxmaps.forosactivos.net/t3350-a-tool-for-downloading-mbtiles-map-alternative-to-mobac">//http://oruxmaps.forosactivos.net/t3350-a-tool-for-downloading-mbtiles-map-alternative-to-mobac



Small & efficient software, that does the job nicely.

But documentation is scarce.

Here is what I've discovered that may be of interest to some of the oruxmaps users:



If the menu "Format Convert" -> "Online maps ..." doesn't launch anything when I click on it:

Looks like a bug. It may happen if "Local IP Address" (in the main PBS window) is set to an IPv6 like "::1". try to set it back to another IP.



Window "Convert Online Maps to MBtiles":



* Always set "RecreateEmptyTiles", so that the creation of the database is faster when resuming a download.

* Don't tick "Compact ?" unless necessary. in most cases, it put a heavy load on the CPU, for very small gain.



* Limit the "download extend" to the target area by using "import shapefile", instead of draw-extent-by-mouse.

In this context, a shapefile is like a polygon area.

less bandwith, less space on disk, less stress on the servers for tiles you don't care about, and faster creation time.

It's quite easy to create a shapefile when you know the trick; see this sites: http://www.mapmash.in/kmlpolyline.html">//http://www.mapmash.in/kmlpolyline.html & http://www.zonums.com/online/kml2shp.php">//http://www.zonums.com/online/kml2shp.php for creating one online, without any additionnal software.



* map creation may be slow at times, and PBS can spend a lot of time "writing to disk".

It is because for some reason,the bigger the map, the longer it takes to append new tiles to it.

So Basically, it all boiled down to the hard drive speed. a SSD would probably be a lot faster than a old 5400rpm HDD.

To speed things up, I used a ramdisk and made PBS write directly to it. it decrease the map creation time tremendously! Once finished, I just need to copy the mbtiles from the ramdisk to the harddrive so it doesn't vanish at power-off.

having 8Gb of RAM, I created a ramdisk of max 5GB, windows swap is kicking in smoothly if needed anyway so it's rather safe.

Software used for ramdisk creation]old sqlite cannot support optimizations[/b] during the creation of big maps.

These optimizations have been in the official releases of sqlite for 5 years now, but this driver pre-date that.

(It appears that MOBAC don't use them neither, while probably using a more recent SQLite framework)



It is a pity because sqlite-writing seems to be on of the main causes of trouble with both software.



If someone has enough knowledge to recompile it with up-to-date libs,

It may be interesting to try these 2 SQLite settings:
QuotePRAGMA synchronous=NORMAL;

PRAGMA journal_mode=WAL;


yip