HERE Maps Javascript API

别来无恙 提交于 2020-05-13 06:41:28

问题


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

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