我想通过 BruTile / SharpMap 将 Here maps 地图图块添加到我的地图中。
他们的文档中的 URL 方案如下:
https://1.base.maps.cit.api.here.com/maptile/2.1/maptile/newest/normal.day/13/4400/2686/256/png8
?app_id={YOUR_APP_ID}
&app_code={YOUR_APP_CODE}
其中 13 是缩放级别,4400 是列,2686 是行。
这是我的代码,但它超时,并且地图为空。应用 id 和应用代码是正确的,这是 100% 确定的。可能是什么问题?
var networkRes = Networking.HasInternetConnection();
if (networkRes.Result == false)
throw new Exception(networkRes.InfoMessage);
var uriString = "https://1.base.maps.cit.api.here.com/maptile/2.1/maptile/newest/normal.day/{z}/{x}/{y}/256/png8";
var customParams = new Dictionary<string, string>();
customParams.Add("app_id", "someappid");
customParams.Add("app_code", "someappcode");
var req = new TmsRequest(new Uri(uriString),"png" , customParams);
var provider = new WebTileProvider(req);
var tileSource = new TileSource(provider, new SphericalMercatorInvertedWorldSchema());
TileLayer tileLayer;
if (CacheWebMaps)
{
var path = Path.Combine(MapCacheRoot, HEREBASELAYERNAME);
tileLayer = new TileLayer(tileSource, HEREBASELAYERNAME, new Color(), true, path);
}
else
{
tileLayer = new TileLayer(tileSource, HEREBASELAYERNAME);
}
tileLayer.SRID = 3857;
MapBox.Map.Layers.Add(tileLayer);
提前致谢!