我想在这里通过BruTile / SharpMap将地图块添加到地图中。
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为行。
这是我的代码,但是它超时了,而且map是空的。App id和app代码是正确的,它是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);提前感谢!
发布于 2016-05-20 18:54:11
您可以创建这里的Maps tiles源代码,如下所示:
var hereMapsTileSource = new HttpTileSource(new GlobalSphericalMercator(0, 8), "https://{s}.base.maps.cit.api.here.com/maptile/2.1/maptile/newest/normal.day/{z}/{x}/{y}/256/png8?app_id=xWVIueSv6JL0aJ5xqTxb&app_code=djPZyynKsbTjIUDOBcHZ2g", new[] {"1", "2", "3", "4"}, name: "Here Maps Source");我向Samples\BruTile.Demo (底部单选按钮)添加了一个示例。这里是我添加的代码。
我不确定SharpMap使用的SharpMap版本是否支持HttpTileSource。否则,您可以将HttpTileSource复制到您自己的项目中。
https://stackoverflow.com/questions/37348582
复制相似问题