1 | goog.require('ol.Graticule');
|
2 | goog.require('ol.Map');
|
3 | goog.require('ol.View');
|
4 | goog.require('ol.format.GeoJSON');
|
5 | goog.require('ol.layer.Vector');
|
6 | goog.require('ol.proj.Projection');
|
7 | goog.require('ol.source.Vector');
|
8 |
|
9 |
|
10 | proj4.defs('ESRI:53009', '+proj=moll +lon_0=0 +x_0=0 +y_0=0 +a=6371000 ' +
|
11 | '+b=6371000 +units=m +no_defs');
|
12 |
|
13 |
|
14 |
|
15 | var sphereMollweideProjection = new ol.proj.Projection({
|
16 | code: 'ESRI:53009',
|
17 | extent: [-9009954.605703328, -9009954.605703328,
|
18 | 9009954.605703328, 9009954.605703328],
|
19 | worldExtent: [-179, -89.99, 179, 89.99]
|
20 | });
|
21 |
|
22 | var map = new ol.Map({
|
23 | keyboardEventTarget: document,
|
24 | layers: [
|
25 | new ol.layer.Vector({
|
26 | source: new ol.source.Vector({
|
27 | url: 'data/geojson/countries-110m.geojson',
|
28 | format: new ol.format.GeoJSON()
|
29 | })
|
30 | })
|
31 | ],
|
32 | target: 'map',
|
33 | view: new ol.View({
|
34 | center: [0, 0],
|
35 | projection: sphereMollweideProjection,
|
36 | resolutions: [65536, 32768, 16384, 8192, 4096, 2048],
|
37 | zoom: 0
|
38 | })
|
39 | });
|
40 |
|
41 | new ol.Graticule({
|
42 | map: map
|
43 | });
|