Search code examples
javascripthighchartsgishighmapsproj4js

Custom map with Highmaps adding mappoint series in latitude and longitude using proj4js


I'm trying to create a map using Highmaps. Data come from two data source in GeoJson format, one for the boundaries of the country and another one to display some cities.

The boundaries is perfectly displayed, but the problem comes when I add the points (cities) using their latitude and longitude.

Due to the fact that Highmaps uses a custom projection all the points are placed in the wrong position or not displayed at all. Following the docs here: http://www.highcharts.com/docs/maps/latlon I'm trying to add the hc-transform in the geojson of the boundaries but I have no luck.

Anyone knows exactly how to write the proj4 string format in the crs in order to work on highmaps?

As I'm displaying, one by one, all the countries, I wonder if I have to configure a customized crs for each country (I mean is it different country by country, or the same for the entire world projection?)

I'm using WGS84 as coord system


Solution

  • I have not developed anything using highchart. From their website i think it is using proj4 to handle the projection. So here comes some examples:

      var wgs84= "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs";
    

    Not sure why you want to costomize crs for each country. So I assume you are going to some spatial analysis. In that case, UTM would be better for your even you just want to calculate area or distance.

    var utm = "+proj=utm +ellps=GRS80 +datum=nad83 +units=m +zone="+ getUTMZone(lon).toString(); 
    

    My example is in NAD83, modify it based on your needs for countries you are interested in.

    Make sure your basemap and your data point are in the same projection coordinate system to avoid incorrect positioning.