Skip to content

Instantly share code, notes, and snippets.

@walkermatt
Forked from nextstopsun/script.js
Created July 5, 2012 19:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save walkermatt/3055717 to your computer and use it in GitHub Desktop.
Save walkermatt/3055717 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(-70.56835304898404, 122.87148413637635),
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://77.37.206.10:10000/tms/1.0.0/adm_conic_EPSG102012/{z}/{x}/{y}.png',
attrib = 'Map data © 2012 OpenStreetMap contributors',
tilelayer = new L.TileLayer(mapUrl, {
scheme: 'tms',
maxZoom: 17,
minZoom: 0,
continuousWorld: true,
attribution: attrib
});
map.addLayer(tilelayer);
map.setView(start, 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment