0

我使用 MicrosoftMapCruncher将图像切片成图块,现在我想将这些图块覆盖到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);
}
4

0 回答 0