How to open local .osm file?

Jul 10, 2010 at 10:29 AM

Hello, radioman!

My task is to write simple application, that shows small part of OpenStreetMap. I select this part at, and export into osm formatted file.

Now I have file named "map.osm".

How show this file in WindowsForms form with GMapControl?

Jul 10, 2010 at 10:34 AM


MainMap.MapType = MapType.OpenStreetMap;
MainMap.MaxZoom = 11;
MainMap.MinZoom = 1;
MainMap.Zoom = MainMap.MinZoom + 1;
MainMap.CurrentPosition = new PointLatLng(54.6961334816182, 25.2985095977783);



Jul 10, 2010 at 10:36 AM

Thanks! But where I must write path to my local file?


Jul 10, 2010 at 10:40 AM

And one note:

my application must work in offline mode. It has only one data source - locally saved osm file.


Jul 10, 2010 at 10:41 AM

thats wrong, just prefetch your wanted are, and be happy using MainMap.Manager.Mode = AccessMode.CacheOnly;

Jul 10, 2010 at 10:56 AM

In my app GMapControl is called "gMap". I write:

public partial class Form1 : Form
        public Form1()

            gMap.Manager.Mode = GMap.NET.AccessMode.CacheOnly;
            gMap.Manager.Language = GMap.NET.LanguageType.Russian;
            gMap.CacheLocation = "D:\\map.osm";

It don't work


Jul 10, 2010 at 10:58 AM

When I run my app - in GMapControl i see - "Exception: No data in local tile cache"


Jul 10, 2010 at 11:06 AM

your code is nonsense ;} no need to call ReloadMap, no need to use any map.osm, all you need is just to import/prefetch tiles from your area, and use gMap.Manager.ImportFromGMDB if it's not imported allready

Jul 10, 2010 at 11:20 AM

O! I understand!