Openlayers 3 如何将OL3矢量平铺与自定义地图投影一起使用
我们有以下使用向量分片的最小示例 如果我们将地图投影更改为Openlayers 3 如何将OL3矢量平铺与自定义地图投影一起使用,openlayers-3,Openlayers 3,我们有以下使用向量分片的最小示例 如果我们将地图投影更改为http://epsg.io/3857。有没有办法告诉矢量文件层或源它应该在其他地图投影上工作 我们的经验是,当我们更改它时,它开始在错误的位置请求平铺-看起来tilegrid正在使用新的mapprojection来请求平铺,而不是http://epsg.io/3857不同工具生成的布局 <!DOCTYPE html> <html> <head> <title>OSM Vector
http://epsg.io/3857
。有没有办法告诉矢量文件层或源它应该在其他地图投影上工作
我们的经验是,当我们更改它时,它开始在错误的位置请求平铺-看起来tilegrid正在使用新的mapprojection来请求平铺,而不是http://epsg.io/3857
不同工具生成的布局
<!DOCTYPE html>
<html>
<head>
<title>OSM Vector Tiles</title>
<link rel="stylesheet" href="http://openlayers.org/en/v3.16.0/css/ol.css" type="text/css">
<script src="http://openlayers.org/en/v3.16.0/build/ol-debug.js"></script>
<style>
.map {
background: #f8f4f0;
}
</style>
</head>
<body>
<div id="map" class="map"></div>
<script>
var format = new ol.format.GeoJSON({ defaultDataProjection : new ol.proj.Projection({
code: '',
units: ol.proj.Units.TILE_PIXELS
})});
var tileGrid = ol.tilegrid.createXYZ({
maxZoom: 22
});
var map = new ol.Map({
layers: [
new ol.layer.Tile({
source: new ol.source.OSM(),
zIndex: 1
}),
new ol.layer.VectorTile({
source: new ol.source.VectorTile({
format: format,
tileGrid: tileGrid,
tilePixelRatio: 16,
url: ...
}),
renderMode: 'vector',
style: [
new ol.style.Style({
fill: new ol.style.Fill({
color: 'rgba(255, 255, 255, 0.2)'
}),
stroke: new ol.style.Stroke({
color: '#33ccff',
width: 2
}),
image: new ol.style.Circle({
radius: 2,
fill: new ol.style.Fill({
color: 'red'
})
})
})
]
})
],
target: 'map',
view: new ol.View({
//center: ol.proj.fromLonLat([9.1645879, 55.7383757]), // Billund
center: ol.proj.fromLonLat([12.1272493, 55.590296]), // Roskilde
maxZoom: 22,
zoom: 12
})
});
</script>
</body>
</html>
矢量图块
.地图{
背景#f8f4f0;
}
var format=new ol.format.GeoJSON({defaultDataProjection:new ol.proj.Projection({
代码:“”,
单位:ol.proj.units.TILE_像素
})});
var tileGrid=ol.tileGrid.createXYZ({
最大缩放:22
});
var map=新ol.map({
图层:[
新ol.layer.Tile({
source:new ol.source.OSM(),
zIndex:1
}),
新ol.layer.VectorTile({
来源:新ol.source.VectorTile({
格式:格式,
tileGrid:tileGrid,
替勒比星比率:16,
网址:。。。
}),
renderMode:'向量',
样式:[
新ol风格({
填充:新的ol.style.fill({
颜色:“rgba(255,255,255,0.2)”
}),
笔划:新的ol风格笔划({
颜色:“#33ccff”,
宽度:2
}),
图片:新ol.style.Circle({
半径:2,
填充:新的ol.style.fill({
颜色:“红色”
})
})
})
]
})
],
目标:“地图”,
视图:新ol.view({
//中心:Lonlat的其他项目([9.1645879,55.7383757]),//Billund
中心:Lonlat的其他项目([12.1272493,55.590296]),//Roskilde
maxZoom:22,
缩放:12
})
});
当前,无法以不同于为其创建平铺的投影的方式渲染矢量平铺层。当前,无法以不同于为其创建平铺的投影的方式渲染矢量平铺层