Search code examples
javascriptphonegapazure-maps

Invalid latitude value: must be between -90 and 90


I'm trying to create a map by javascript Azure Map in my phonegap app, but it gives the following error:

atlas.min.js?api-version=1.0:362 Uncaught (in promise) Error: Invalid LngLat latitude value: must be between -90 and 90

And my code:

 var map = new atlas.Map("task-map-view", {
        "subscription-key": MapsAccountKey,
        center: [39.749434, -104.930420],
        zoom: 8
    });

any suggestions?


Solution

  • It looks like you have reversed your latitude and longitude values. Note that Azure maps coordinates are represented as [longitude, latitude].

    If you are curious as to why, longitude is equivalent to x and latitude to y, thus [x, y]