MapWinGIS 4.9.3 and osm-files

Jan 5, 2015 at 12:01 PM
The new built-in tileprovider functionality is great, but I need to use OpenStreetMap offline. I have downloaded an .osm file (covers entire Finland) which should include tiles and other data as well.

How can I use the osm file in MapWinGIS without having to connect to any url (basically without an internet connection)?
Jan 5, 2015 at 2:57 PM
Edited Jan 5, 2015 at 3:18 PM
Unfortunately MapWinGIS doesn't support .osm files. They also can't be directly consumed by QGis, for example, however it seems some conversion mechanism exists: Converted SpatialLite db described there can be accessed by MapWinGIS using OgrLayer.

MapWinGIS also allows offline use of tiles via caching. It uses SQlite database to store the cache. It's populated during normal map use or by Tiles.Prefetch method.

In case of the .osm file if it indeed stores tiles as bitmaps (and not just xml with coordinates), I guess it won't be difficult to write a script to parse the file, extract bitmaps and write them to the cache database as GDI+ bitmaps. The database is created automatically, is called mwtiles.db and by default is located in the same folder with .exe file of your app. Db structure is quite self evident (Tiles.Type is the id of provider, i.e. (int)tkTileProvider, 0 for OpenStreetMap). The path to database can be changed with Tiles.DiskCacheFilename.

BTW, we are making our policy regarding tile providers licensing stricter in version So please check this topics: tiles, changes in version 4.9.3.