United Kingdom - Highmaps
Highmaps demo
HTML
<script src="http://cdnjs.cloudflare.com/ajax/libs/proj4js/2.2.2/proj4.js"></script>
<script src="http://github.highcharts.com/latlon/highmaps.js"></script>
<script src="http://code.highcharts.com/maps/modules/exporting.js"></script>
<script src="http://code.highcharts.com/mapdata/custom/world.js"></script>
<div id="container"></div>
CSS
#container {
height: 680px;
min-width: 310px;
max-width: 800px;
margin: 0 auto;
}
.loading {
margin-top: 10em;
text-align: center;
color: gray;
}
JavaScript
$(function () {
// Initiate the chart
$('#container').highcharts('Map', {
title: {
text: 'Highmaps lat/lon demo'
},
mapNavigation: {
enabled: true
},
tooltip: {
// Use lat/lon instead of x/y in tooltip if point has lat/lon defined
formatter: function () {
console.log('---> THIS POINT:', this.point);
if(this.point.lat) {
return this.point.name + '<br>Lat: ' + this.point.lat + ' Lon: ' + this.point.lon;
} else {
// We don't have lat/lon defined.
// Assume this is a point of interest with Shetland transform and act accordingly.
var transform = Highcharts.maps['countries/gb/gb-all']['hc-transform']['gb-all-shetland'],
pos = this.series.chart.transformToLatLon(this.point, transform);
return this.point.name + '<br>Lat: ' + pos.lat.toFixed(3) + ' Lon: ' + pos.lon.toFixed(3);
}
},
},
series: [{
// Use the gb-all map with no data as a basemap
mapData: Highcharts.maps['custom/world'],
name: 'Basemap'
}, {
name: 'Points',
type: 'mappoint',
data: [{
name: 'London',
lat: 51.507222,
lon: -0.1275
}, {
name: 'Moscow',
lat: 55.7500,
lon: 37.6167
}, {
name: 'Beijing',
lat: 39.9167,
lon: 116.3833
}, {
name: 'Washington D.C.',
lat: 38.889931,
lon: -77.009003
}]
}]
});
// Add point of interest using Shetland transform. Using normal lat/lon options would place this point relative to mainland UK, since it is not within the bounding box of...