Reputation: 11
I am trying to render the map in one of my SAP UI5 app. I followed the documentation, after which i was able to initialize the H.service.Platform
. But when I initialize H.Map()
the map does not render. Upon debugging found out a call
https://js.hereapi.com/v3/3.1.9.0/styles/omv/normal.day.yaml?xnlp=CL_JSMv3.1.9.0&apikey=myApiKey is made which fails as the address is never found.
So I tried to build a normal HTML project which worked fine. Upon debugging found out the call for the same came out to be https://js.api.here.com/v3/3.1//styles/omv/normal.day.yaml
As you can see there is a difference in the URL.
I tried setting the baseUrl parameter in the H.service.Platform()
to baseUrl: new H.service.Url('https', 'api.here.com')
.
This works for the above-mentioned request, but the rest of the requests fail now.
For eg.https://1.base.maps.ls.hereapi.com/maptile/2.1/info?xnlp=CL_JSMv3.1.9.0&apikey=myApiKey&output=json
fails
(it worked before setting baseUrl parameter)
The code used is
if (H) {
var platform = new H.service.Platform({
apikey: myApiKey
/*,
baseUrl: new H.service.Url('https', 'api.here.com')*/
});
// Get an object containing the default map layers:
var defaultLayers = platform.createDefaultLayers();
// Instantiate the map using the vecor map with the
// default style as the base layer:
var map = new H.Map(this.byId("mapBox").getDomRef(),
defaultLayers.vector.normal.map, {
center: {
lat: 50,
lng: 5
},
zoom: 4,
pixelRatio: window.devicePixelRatio || 1
});
var behavior = new H.mapevents.Behavior(new H.mapevents.MapEvents(map));
// Create the default UI components
var ui = H.ui.UI.createDefault(map, defaultLayers);
}
Upvotes: 0
Views: 507
Reputation: 1887
This issue is difficult to reproduce as it's happening within specific framework, but try to re-set the style for vector normal map layer after creating defaultLayers:
defaultLayers.vector.normal.map.getProvider().setStyle(
new H.map.Style('https://js.api.here.com/v3/3.1/styles/omv/normal.day.yaml')
);
Upvotes: 1