Search code examples
highmaps

Looking for a Highmaps example of worldmap with GPS coordinates


Looking for a Highmaps example of world map with GPS coordinates. Searched docs and google and no luck.

The idea is to set a LAT LNG array of points and display all points across the Highcharts map.


Solution

  • You need to load proj4js before Highmaps, for example from cdnjs like this:

    <script src="https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.12/proj4-src.js"></script>
    

    Then when creating your series you give each point a lat and a lon, like this:

    series: [{
        data: [{
            name: 'London',
            lat: 51.507222,
            lon: -0.1275
        }]
    }]
    

    See this JSFiddle demonstration and this more comprehensive lat/lng documentation.