GMap .net离线 [英] GMap .net offline

查看:391
本文介绍了GMap .net离线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用c#(出色的API,顺便说一句)中的Gmap开发应用程序,不要与google-map API混淆,从那时起我就做了一些非常酷而有用的事情.

我的问题是我的一些客户没有互联网连接,这就是为什么我需要能够离线显示背景(地图)的原因.我曾经使用属性GMap.NET.AccessMode.ServerAndCache;从服务器上获取数据,现在我希望能够将GMap.NET.AccessMode.CacheOnly与完整的缓存一起使用.

让它们通过连接加载缓存以准备脱机使用不是一种选择,因为PC永远不会连接到Internet.经过一番研究,我了解到OpenStreetMap是唯一允许我免费使用其地图的开源地图(这很好,因为它们具有非常好的地图).我下载了一张20GB的欧洲地图,但不知道如何将其指定为缓存(我知道如何找到缓存文件夹).

在大多数情况下,我的Google搜索显示有人试图创建一个虚拟sqlite服务器,其中所有地图磁贴都通过本地主机访问数据库中,但是老实说,我认为这非常复杂,我想知道是否有人一种使我可以脱机使用这些地图的想法,或者是该api文档的链接,无法在网上找到(我找到了源,但几乎没有评论,也没有解释).

在此先感谢您,我的英语不好.

在法语两方面的反应.

解决方案

,您可以创建一个单独的程序来预取切片以供离线使用.或使用GMap NET演示程序( https://github.com/radioman/greatmaps/tree/master/Demo.WindowsPresentation )

下面的代码用于在使用ALT +鼠标第一键选择区域后按下按钮.

        RectLatLng area = mapView.SelectedArea;

        if (!area.IsEmpty)
        {
            for (int i = (int)mapView.Zoom; i <= mapView.MaxZoom; i++)
            {
                TilePrefetcher obj = new TilePrefetcher();
                obj.Title = "Prefetching Tiles";
                obj.Icon = this.Icon;
                obj.Owner = this;
                obj.ShowCompleteMessage = false;
                obj.Start(area, i, mapView.MapProvider, 100);
            }

            DialogResult = true;
            Close();
        }
        else
        {
            MessageBox.Show("No Area Chosen", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
        }

(主要从Gmap NET演示源复制)

https://github.com/radioman/greatmaps/tree/master/Demo.WindowsPresentation

文件存储在C:\ Users \ [您的用户名] \ AppData \ Local \ GMap.NET \ TileDBv5 \ en

一旦成功预取了图块,就可以将文件复制到离线PC的相同位置,并且它应该使用它(或者只是通过USB或其他方式将整个GMap.NET文件夹复制到离线PC)

I'm developing an application using Gmap in c# (great API, btw), not to confuse with google-map API, and I did some really cool and useful stuff ever since.

My problem is that some of my clients won't have an internet connection, and that is why I need to be able to display the background (the map) offline. I used to use the property GMap.NET.AccessMode.ServerAndCache; to get my data from the server, and now I would like to be able to use GMap.NET.AccessMode.CacheOnly with a full cache.

Letting them load the cache with a connection to prepare for an offline use is not an option, the PCs will never be connected to the internet. After some research, I learned OpenStreetMap is the only open source map that would allow me to use their map for free (and that is good because they have very good maps). I downloaded a 20GB map of Europe, but I have no idea how to specify it as the cache (I know how to locate the cache folder).

Most of the time, my Google searches showed me people trying to create a virtual sqlite server with all the map's tiles in a DB accessed via localhost, but honestly I think this is very complex and I would like to know if anybody has an idea to allow me to use those maps offline or a link for the doc of this api, impossible to find on the net (I found the sources, but almost no comment and no explanation).

Thanks in advance, and sorry for my bad English.

réponses en français bienvenues.

解决方案

you can create a separate program to prefetch tiles for offline use. Or use the GMap NET demo program (https://github.com/radioman/greatmaps/tree/master/Demo.WindowsPresentation)

The code below is for a button press after you've selected an area using ALT + mouse first button.

        RectLatLng area = mapView.SelectedArea;

        if (!area.IsEmpty)
        {
            for (int i = (int)mapView.Zoom; i <= mapView.MaxZoom; i++)
            {
                TilePrefetcher obj = new TilePrefetcher();
                obj.Title = "Prefetching Tiles";
                obj.Icon = this.Icon;
                obj.Owner = this;
                obj.ShowCompleteMessage = false;
                obj.Start(area, i, mapView.MapProvider, 100);
            }

            DialogResult = true;
            Close();
        }
        else
        {
            MessageBox.Show("No Area Chosen", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
        }

(mostly copied from Gmap NET Demo source)

https://github.com/radioman/greatmaps/tree/master/Demo.WindowsPresentation

The Files are stored in C:\Users\[your user name]\AppData\Local\GMap.NET\TileDBv5\en

Once you've successfully prefetched the tiles you can copy the files to the same location in the offline pc and it should use it (or just copy the whole GMap.NET folder to the offline pc via usb or whatever)

这篇关于GMap .net离线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆