我刚刚安装了 geoserver,但我在让它工作时遇到了一些麻烦。我正在使用安装时提供的示例进行一些测试,特别是tiger:tiger_roads
. 尽管我可以得到瓷砖,但当我在地图上移动时,它会404
在 chrome 控制台上抛出错误,并且下一个响应:
Coverage [minx,miny,maxx,maxy] is [2411, 5111, 2414, 5116, 13], index [x,y,z] is [2410, 5113, 13]
我希望 geoserver 返回 204(没有数据也可以),因为在该范围内没有任何内容可以显示。
这是正常的行为吗?如果没有,我要设置什么来防止该错误?
这是一个完整的index.html
,您可以在其中重现问题。只需打开它,然后沿着地图移动,或更改缩放。
<html>
<head>
<title>Vector tiles</title>
<script src="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.1.1/build/ol.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.1.1/css/ol.css" type="text/css">
<style>
html, body {
font-family: sans-serif;
width: 100%;
}
.map {
height: 500px;
width: 100%;
}
</style>
</head>
<body>
<h3>Mapbox Protobuf - vector tiles</h3>
<div id="map" class="map"></div>
<script>
var style_simple = new ol.style.Style({
fill: new ol.style.Fill({
color: '#ADD8E6'
}),
stroke: new ol.style.Stroke({
color: '#880000',
width: 1
})
});
function simpleStyle(feature) {
return style_simple;
}
var layer = 'tiger:tiger_roads';
var projection_epsg_no = '900913';
var map = new ol.Map({
target: 'map',
view: new ol.View({
center: ol.proj.fromLonLat([-73.985130, 40.758896]),
zoom: 13
}),
layers: [new ol.layer.VectorTile({
style:simpleStyle,
source: new ol.source.VectorTile({
tilePixelRatio: 1, // oversampling when > 1
tileGrid: ol.tilegrid.createXYZ({maxZoom: 19}),
format: new ol.format.MVT(),
url: 'http://ec2-34-242-255-134.eu-west-1.compute.amazonaws.com:8080/geoserver/gwc/service/tms/1.0.0/' + layer +
'@EPSG%3A'+projection_epsg_no+'@pbf/{z}/{x}/{-y}.pbf'
})
})]
});
</script>
</body>
</html>