Skip to content

Instantly share code, notes, and snippets.

@nextstopsun
Created August 23, 2012 09:27
Show Gist options
  • Save nextstopsun/3434626 to your computer and use it in GitHub Desktop.
Save nextstopsun/3434626 to your computer and use it in GitHub Desktop.
Proj4Leaflet with Leaflet 0.4.4 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),
scale = function(zoom) { return 1 / res[zoom];},
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)),
map = new L.Map('map', {
crs: crs,
scale: scale,
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.options.crs.scale = scale;
map.addLayer(tilelayer);
map.setView(start, 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment