Here JavaScript 3.0 API - decent color scheme

时光怂恿深爱的人放手 提交于 2020-01-06 12:40:05

问题


I'm adding a Here Map as fullscreen interactive background to a website. Now I'm searching for a way to change the color scheme to a more subtile one.

I know there is the Map Tile API - but I really want to have the map interactive, not just an image. I think with API 2.5 there was a way for a grey color scheme?

In moment I just change the CSS opacity but this isn't optimal, because it also makes the buttons like (zoom, ...) less visible.


回答1:


The JS API connects pretty seamlessly to the Map Tile API in the background and in fact the default layers (retrieved by a call to platform.createDefaultLayers()) do exactly that: they use the Map Tile API. If you don't want to use any of the default ones provided you can create a custom map tile layer pointing to any of the available map schemes:

//Step 1: initialize communication with the platform
var platform = new H.service.Platform({
  app_id: 'DemoAppId01082013GAL',
  app_code: 'AJKnXv84fjrb0KIHawS0Tg',
  useCIT: true
});

//Instead of using the default layers...
//var defaultLayers = platform.createDefaultLayers();

//...create your own layer (with e.g. the "reduced" scheme
var reduced = platform.getMapTileService({
  type: 'base'
}).createTileLayer("maptile", "reduced.day", 256, "png8");

//Step 2: initialize a map using your custom map tile layer
var map = new H.Map(document.getElementById('mapp'), reduced, {
  center: {
    lat: 52.3,
    lng: 13.8
  },
  zoom: 10
});

//Step 3: make the map interactive
var behavior = new H.mapevents.Behavior(new H.mapevents.MapEvents(map));

Here are some links that may be useful for your quest:

MapTileService class description http://developer.here.com/javascript-apis/documentation/v3/maps/topics_api_nlp/h-service-maptileservice.html

Available schemes on the Map Tile API http://developer.here.com/rest-apis/documentation/enterprise-map-tile/topics/resource-map-tile.html



来源:https://stackoverflow.com/questions/26604660/here-javascript-3-0-api-decent-color-scheme

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!