问题
Just getting started using the sample javascript to simply display a map based on latitude and longitude coordinates. I get a javascript ReferenceError on the very first line!
code snippet:
<script src="http://js.api.here.com/v3/3.0/mapsjs-core.js" type="text/javascript" charset="utf-8"></script>
<script src="http://js.api.here.com/v3/3.0/mapsjs-service.js" type="text/javascript" charset="utf-8"></script>
var platform = new H.service.Platform({
'app_id': 'xxxxxxxxxxxxxxxxxxxx',
'app_code': 'zzzzzzzzzzzzzzzzzzzzzzz'
});
// Obtain the default map types from the platform object
var maptypes = platform.createDefaultLayers();
// Instantiate (and display) a map object:
var map = new H.Map(document.getElementById('bodydiv'), maptypes.normal.map, {
zoom: 10, center: { lng: <%=longitude%>, lat: <%=latitude%>}
});
Actual error in browser console: ReferenceError: H is not defined - happens on var platform=...
Any ideas?
回答1:
Try including all the JS files mentioned in the example and also the css file https://developer.here.com/api-explorer
来源:https://stackoverflow.com/questions/35212768/here-maps-javascript-api