最佳答案
对于一个简单的静态HERE贴图,您应该看一下Map Image API – 这将嵌入一个简单的图像.但是,如果您想要一张可移动的地图,可以在IFrame中使用HERE Maps API for JavaScript并传递您选择的纬度,经度和缩放级别,例如:就像是:
Meta name="viewport" content="initial-scale=1.0,width=device-width" />
aram {String} name key in the query string
* @return {String} value
*/
function getParameterByName(name) {
name = name.replace(/[\[]/,'\\\[').replace(/[\]]/,'\\\]');
var regex = new RegExp('[\\?&]' + name + '=([^&#]*)'),results = regex.exec(location.search);
return results === null ? '' :
decodeURIComponent(results[1].replace(/\+/g,' '));
}
/**
* Moves the map to display at agiven location
* @param {H.Map} map A HERE Map instance within the application
*/
function moveMap(map,location,zoom){
var lat = getParameterByName('lat'),lng = getParameterByName('lng');
zoom = getParameterByName('zoom');
map.setCenter({lat: lat,lng: lng});
map.setZoom(zoom);
}
/**
* Boilerplate map initialization code starts below:
*/
//Step 1: initialize communication with the platform
var platform = new H.service.Platform({
app_id: 'normal.map);
//Step 3: make the map interactive
// MapEvents enables the event system
// Behavior implements default interactions for pan/zoom (also on mobile touch environments)
var behavior = new H.mapevents.Behavior(new H.mapevents.MapEvents(map));
// Create the default UI components
var ui = H.ui.UI.createDefault(map,defaultLayers);
// Now use the map as required...
moveMap(map);
可以调用iframe指定高度和宽度:
结果是这样的:
当然,您可以添加所有常用的其他内容,例如添加标记等,以使地图做您想要的,而不仅仅是提供商提供的内容.为什么要限制为地图提供商提供的单一外观?