init
This commit is contained in:
parent
b1dc7e9d0b
commit
ad58e618a6
|
@ -21,7 +21,7 @@ function initMap(id, type) {
|
||||||
var tMl = new ol.layer.Tile({
|
var tMl = new ol.layer.Tile({
|
||||||
title: "天地图路网",
|
title: "天地图路网",
|
||||||
source: new ol.source.XYZ({
|
source: new ol.source.XYZ({
|
||||||
url: "http://t4.tianditu.com/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=16d2779796f67de83223d5d3ec42d34b"
|
url: "http://t4.tianditu.com/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=5a47a61bbbb33e0149def12540accd4b"
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
map.addLayer(tMl);
|
map.addLayer(tMl);
|
||||||
|
@ -30,7 +30,7 @@ function initMap(id, type) {
|
||||||
var tAL = new ol.layer.Tile({
|
var tAL = new ol.layer.Tile({
|
||||||
title: "天地图文字标注",
|
title: "天地图文字标注",
|
||||||
source: new ol.source.XYZ({
|
source: new ol.source.XYZ({
|
||||||
url: 'http://t3.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=16d2779796f67de83223d5d3ec42d34b'
|
url: 'http://t3.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=5a47a61bbbb33e0149def12540accd4b'
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
map.addLayer(tAL);
|
map.addLayer(tAL);
|
||||||
|
|
|
@ -1,6 +1,42 @@
|
||||||
/**
|
/**
|
||||||
* Created by baoliang on 07/12/2016.
|
* Created by baoliang on 07/12/2016.
|
||||||
*/
|
*/
|
||||||
|
//创建图层(WMTS方式)
|
||||||
|
function crtLayerWMTS(type, proj, opacity) {
|
||||||
|
var projection = ol.proj.get(proj);
|
||||||
|
var projectionExtent = projection.getExtent();
|
||||||
|
var size = ol.extent.getWidth(projectionExtent) / 256;
|
||||||
|
var resolutions = new Array(19);
|
||||||
|
var matrixIds = new Array(19);
|
||||||
|
for (var z = 1; z < 19; ++z) {
|
||||||
|
// generate resolutions and matrixIds arrays for this WMTS
|
||||||
|
resolutions[z] = size / Math.pow(2, z);
|
||||||
|
matrixIds[z] = z;
|
||||||
|
}
|
||||||
|
|
||||||
|
var layer = new ol.layer.Tile({
|
||||||
|
opacity: opacity,
|
||||||
|
source: new ol.source.WMTS({
|
||||||
|
attributions: 'Tiles © <a href="http://www.tianditu.com/service/info.html?sid=5292&type=info">天地图</a>',
|
||||||
|
url: 'http://t' + Math.round(Math.random() * 7) + '.tianditu.gov.cn/' + type + '/wmts?tk=5a47a61bbbb33e0149def12540accd4b',
|
||||||
|
layer: type.substr(0, 3),
|
||||||
|
matrixSet: type.substring(4),
|
||||||
|
format: 'tiles',
|
||||||
|
projection: projection,
|
||||||
|
tileGrid: new ol.tilegrid.WMTS({
|
||||||
|
origin: ol.extent.getTopLeft(projectionExtent),
|
||||||
|
resolutions: resolutions,
|
||||||
|
matrixIds: matrixIds
|
||||||
|
}),
|
||||||
|
style: 'default',
|
||||||
|
wrapX: true
|
||||||
|
})
|
||||||
|
});
|
||||||
|
layer.id = type;
|
||||||
|
return layer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
var map = new ol.Map({
|
var map = new ol.Map({
|
||||||
target: 'map',
|
target: 'map',
|
||||||
|
@ -219,6 +255,7 @@ $(function () {
|
||||||
var id = $(this).data('id');
|
var id = $(this).data('id');
|
||||||
loadFeatures_drilling('/graphics/drilling_geojson/', {id: id}, landDrillingSource);
|
loadFeatures_drilling('/graphics/drilling_geojson/', {id: id}, landDrillingSource);
|
||||||
});
|
});
|
||||||
|
|
||||||
function loadFeatures(url, params, source) {
|
function loadFeatures(url, params, source) {
|
||||||
$.get(url, params, function (data) {
|
$.get(url, params, function (data) {
|
||||||
var geojsonFormat = new ol.format.GeoJSON({});
|
var geojsonFormat = new ol.format.GeoJSON({});
|
||||||
|
@ -274,7 +311,7 @@ var initTianDiTuMapLayer = function (map) {
|
||||||
var tMl = new ol.layer.Tile({
|
var tMl = new ol.layer.Tile({
|
||||||
title: "天地图路网",
|
title: "天地图路网",
|
||||||
source: new ol.source.XYZ({
|
source: new ol.source.XYZ({
|
||||||
url: "http://t4.tianditu.com/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=16d2779796f67de83223d5d3ec42d34b"
|
url: "http://t4.tianditu.com/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=5a47a61bbbb33e0149def12540accd4b"
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
map.addLayer(tMl);
|
map.addLayer(tMl);
|
||||||
|
@ -287,7 +324,7 @@ var initTianDiTuSatelliteLayer = function (map) {
|
||||||
visible: false,
|
visible: false,
|
||||||
title: "天地图卫星影像",
|
title: "天地图卫星影像",
|
||||||
source: new ol.source.XYZ({
|
source: new ol.source.XYZ({
|
||||||
url: 'http://t0.tianditu.com/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=16d2779796f67de83223d5d3ec42d34b'
|
url: 'http://t0.tianditu.com/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=5a47a61bbbb33e0149def12540accd4b'
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
map.addLayer(tSL);
|
map.addLayer(tSL);
|
||||||
|
@ -299,7 +336,7 @@ var initTianDiTuAnnotationLayer = function (map) {
|
||||||
var tAL = new ol.layer.Tile({
|
var tAL = new ol.layer.Tile({
|
||||||
title: "天地图文字标注",
|
title: "天地图文字标注",
|
||||||
source: new ol.source.XYZ({
|
source: new ol.source.XYZ({
|
||||||
url: 'http://t3.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=16d2779796f67de83223d5d3ec42d34b'
|
url: 'http://t3.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=5a47a61bbbb33e0149def12540accd4b'
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
map.addLayer(tAL);
|
map.addLayer(tAL);
|
||||||
|
|
|
@ -124,7 +124,7 @@
|
||||||
title: "天地图路网",
|
title: "天地图路网",
|
||||||
source: new ol.source.XYZ({
|
source: new ol.source.XYZ({
|
||||||
|
|
||||||
url: "http://t4.tianditu.com/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=16d2779796f67de83223d5d3ec42d34b"
|
url: "http://t4.tianditu.com/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=5a47a61bbbb33e0149def12540accd4b"
|
||||||
}),
|
}),
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -134,7 +134,7 @@
|
||||||
var tian_di_tu_annotation = new ol.layer.Tile({
|
var tian_di_tu_annotation = new ol.layer.Tile({
|
||||||
title: "天地图文字标注",
|
title: "天地图文字标注",
|
||||||
source: new ol.source.XYZ({
|
source: new ol.source.XYZ({
|
||||||
url: 'http://t3.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=16d2779796f67de83223d5d3ec42d34b'
|
url: 'http://t3.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=5a47a61bbbb33e0149def12540accd4b'
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@
|
||||||
var tian_di_tu_satellite_layer = new ol.layer.Tile({
|
var tian_di_tu_satellite_layer = new ol.layer.Tile({
|
||||||
title: "天地图卫星影像",
|
title: "天地图卫星影像",
|
||||||
source: new ol.source.XYZ({
|
source: new ol.source.XYZ({
|
||||||
url: 'http://t0.tianditu.com/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=16d2779796f67de83223d5d3ec42d34b'
|
url: 'http://t0.tianditu.com/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=5a47a61bbbb33e0149def12540accd4b'
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ function initMap() {
|
||||||
var tMl = new ol.layer.Tile({
|
var tMl = new ol.layer.Tile({
|
||||||
title: "天地图路网",
|
title: "天地图路网",
|
||||||
source: new ol.source.XYZ({
|
source: new ol.source.XYZ({
|
||||||
url: "http://t4.tianditu.com/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=16d2779796f67de83223d5d3ec42d34b"
|
url: "http://t4.tianditu.com/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=5a47a61bbbb33e0149def12540accd4b"
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
map.addLayer(tMl);
|
map.addLayer(tMl);
|
||||||
|
@ -29,7 +29,7 @@ function initMap() {
|
||||||
var tAL = new ol.layer.Tile({
|
var tAL = new ol.layer.Tile({
|
||||||
title: "天地图文字标注",
|
title: "天地图文字标注",
|
||||||
source: new ol.source.XYZ({
|
source: new ol.source.XYZ({
|
||||||
url: 'http://t3.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=16d2779796f67de83223d5d3ec42d34b'
|
url: 'http://t3.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=5a47a61bbbb33e0149def12540accd4b'
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
map.addLayer(tAL);
|
map.addLayer(tAL);
|
||||||
|
|
|
@ -245,7 +245,7 @@
|
||||||
title: "天地图路网",
|
title: "天地图路网",
|
||||||
source: new ol.source.XYZ({
|
source: new ol.source.XYZ({
|
||||||
|
|
||||||
url: "http://t4.tianditu.com/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=16d2779796f67de83223d5d3ec42d34b"
|
url: "http://t4.tianditu.com/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=5a47a61bbbb33e0149def12540accd4b"
|
||||||
}),
|
}),
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -255,7 +255,7 @@
|
||||||
var tian_di_tu_annotation = new ol.layer.Tile({
|
var tian_di_tu_annotation = new ol.layer.Tile({
|
||||||
title: "天地图文字标注",
|
title: "天地图文字标注",
|
||||||
source: new ol.source.XYZ({
|
source: new ol.source.XYZ({
|
||||||
url: 'http://t3.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=16d2779796f67de83223d5d3ec42d34b'
|
url: 'http://t3.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=5a47a61bbbb33e0149def12540accd4b'
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue