将mapCruncher切片与Gmap.Net一起使用

时间:2015-06-02 13:17:58

标签: c# gmap.net

我使用Microsoft的MapCruncher将图片切割成图块,现在我想将这些图块叠加到GMap.Net中。我试过这个例子,但我的程序甚至没有开始。这是我尝试但程序无法启动。我有所有的瓷砖。现在只需要把它们带到GMap。

try
{
    int c = 0;
    int type = GMapProviders.LithuaniaTOP50Map.DbId;
    //GMaps.Instance.PrimaryCache.DeleteOlderThan(DateTime.MaxValue, type);

    var import = Directory.GetFiles(@"C:\Users\Vaib\Desktop\tiles\Layer_NewLayer\", "*.jpg", SearchOption.AllDirectories).Where(p => p.Contains("Layer_") && !p.Contains("black")).ToList();

    int total = import.Count;

    foreach (var i in import)
    {
        var qk = Path.GetFileNameWithoutExtension(i);

        int x = 0;
        int y = 0;
        int z = 0;
        GMapProviders.BingMap.QuadKeyToTileXY(qk, out x, out y, out z);

        // GMapProviders.BingMap.
        Debug.WriteLine(c++ + " of " + total + ", x: " + x + ", y: " + y + ", z: " + z);

        if (!GMaps.Instance.PrimaryCache.PutImageToCache(File.ReadAllBytes(i), type, new GPoint(x, y), z))
        {
            break;
        }
    }
}
catch (Exception ex)
{
    Debug.WriteLine("import: " + ex);
}

0 个答案:

没有答案