I use GMap.NET in the application I developed on a Windows form application. It works fine, but how can I make it work in an environment without internet?
(First of all, I'm sorry for my bad English, English is not my native language.)
I am trying to develop a simple application on Windows form application (C# .NET 8.0). I apologize for my inexperience as I am new to this field.
Below is the code of my application.
using GMap.NET;
using GMap.NET.MapProviders;
using GMap.NET.WindowsForms;
using System;
using System.Windows.Forms;
namespace harita_3_offline
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
/* Map Config */
//gMapControl1.Dock = DockStyle.Fill;
GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerAndCache;
gMapControl1.CacheLocation = @"D:\\cache\\turkey.mbtiles";
gMapControl1.DragButton = MouseButtons.Left;
gMapControl1.MapProvider = GMapProviders.GoogleMap;
gMapControl1.Position = new GMap.NET.PointLatLng(37.87425528270441, 32.493648881146235);
gMapControl1.MinZoom = 1;
gMapControl1.MaxZoom = 20;
gMapControl1.Zoom = 15;
gMapControl1.ShowCenter = false;
/* ./Map Config */
}
}
}
I have a map object named gMapControl1. There are a few customizations in my code.
My problem is, The map works fine when connected to the internet. But when I disconnect the internet, the map is corrupted and does not work.
I downloaded a ".mbtiles" file from the internet. This is how I added it to my application.
gMapControl1.CacheLocation = @"D:\\cache\\turkey.mbtiles";
But this didn't solve my problem. I did research on the internet. It says it can show the cached map. But what I want is to show the map of the entire country I downloaded. How can I do that?
I tried some solutions below but none of them worked :(
GreatMaps (GMap.net) Offline Files...To Download? I couldn't run the shared github application because it was old.
GMap .net offline Likewise, I could not manage to run it because the codes shared on github were too old.
