【发布时间】:2016-05-20 13:56:36
【问题描述】:
我想通过 BruTile / SharpMap 将 Here 地图图块添加到我的地图中。
他们的文档中的 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);
提前致谢!
【问题讨论】:
-
您是否在他们的文档中将此作为基础?如果有,是哪个?
-
我使用了这个文档:developer.here.com/rest-apis/documentation/enterprise-map-tile/… 和我自己编写的代码,我已经成功实现了几个瓦片源(osm 的、MapQuest、自定义的等),但我无法让 Here 地图工作
-
Here 是您在顶部发布的url,其中包含Here maps 网站的app id 和app code。它是否还会在浏览器中显示带有您的应用 ID 和代码的磁贴?
-
是的,我可以通过浏览器获取图块