Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HERE Maps Javascript API

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?

like image 236
K Goddard Avatar asked Nov 09 '22 20:11

K Goddard


1 Answers

Try including all the JS files mentioned in the example and also the css file https://developer.here.com/api-explorer

like image 168
Jithin Krishnan Avatar answered Nov 15 '22 06:11

Jithin Krishnan