使用HERE Maps API的高分辨率地图 [英] High-resolution maps using the HERE Maps API
问题描述
我如何显示类似于 https://beta.here.com 使用HERE Maps API for JavaScript?
How would I display a high-resolution map similar to the one at https://beta.here.com using the HERE Maps API for JavaScript?
从 API参考创建地图时可以更改pixelRatio
的选项.
From the API reference there is an option to change the pixelRatio
when creating a map.
var map = new H.Map(
document.getElementById('map'),
defaultLayers.normal.map,
{ pixelRatio: 2 }
);
这很好用,并且可以在高DPI屏幕上生成高分辨率的地图,但是,这改变了地图的比例,所有地图对象都变小了,文本也变得难以阅读.
This works great and produces a high-resolution map on high-DPI screens, however, this changes the scale of the map and all map objects become small and text becomes difficult to read.
推荐答案
PPI设置在JavaScript API参考中没有得到很好的记录,但在
The PPI settings aren't documented very well in the JavaScript API reference, but is documented in the Map Tile API.
像素每英寸.可以请求的分辨率,有效值为: 72 –正常,默认情况下使用(如果未提供任何值) 250 –移动 320 –高分辨率
Pixels per inch. Resolution that can be requested, valid values are: 72 – normal, used by default if no value provided 250 – mobile 320 – hi-res
您可以在创建默认图层(第二个选项)时指定PPI.
You can specify the PPI when creating a default layer (second option).
var defaultLayers = platform.createDefaultLayers(512, 320);
var map = new H.Map(
document.getElementById('map'),
defaultLayers.normal.map,
{ pixelRatio: 2 }
);
这篇关于使用HERE Maps API的高分辨率地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!