Skip to content

Instantly share code, notes, and snippets.

@nextstopsun
Created July 4, 2012 16:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nextstopsun/3048314 to your computer and use it in GitHub Desktop.
Save nextstopsun/3048314 to your computer and use it in GitHub Desktop.
Proj4Leaflet 102012 projection test
var res = [
140000.0000000000,
70000.0000000000,
35000.0000000000,
17500.0000000000,
8750.0000000000,
4375.0000000000,
2187.5000000000,
1093.7500000000,
546.8750000000,
273.4375000000,
136.7187500000,
68.3593750000,
34.1796875000,
17.0898437500,
8.5449218750,
4.2724609375,
2.1362304688,
1.0681152344],
start = new L.LatLng(55.727, 37.639),
map = new L.Map('map', {
crs: L.CRS.proj4js('EPSG:102012',
'+proj=lcc +lat_1=30 +lat_2=62 +lat_0=0 +lon_0=105 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs',
new L.Transformation(1, -4558997.24909, 1, 5368033.51783)),
scale: function(zoom) {
return 1 / res[zoom];
},
continuousWorld: true
}),
mapUrl = 'http://localhost:10000/tiles/1.0.0/adm_conic_EPSG102012/{z}/{x}/{y}.png',
attrib = 'Map data © 2012 OpenStreetMap contributors',
tilelayer = new L.TileLayer(mapUrl, {
scheme: 'tms',
maxZoom: 18,
minZoom: 0,
continuousWorld: true,
attribution: attrib
});
map.addLayer(tilelayer);
map.setView(start, 3);
//-4558997.24908565, 5368033.51782977, 3574819.18499759, 9993228.07499633
//218128.7031, 6126002.9379, 1083427.2970, 7692850.9468
//1, -218128.7031, -1, 6126002.9379
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment