Mapbox 为什么Geoserver返回404响应,但有覆盖范围限制?
我刚刚安装了geoserver,但在运行时遇到了一些问题。我正在使用安装中提供的示例进行一些测试,特别是使用Mapbox 为什么Geoserver返回404响应,但有覆盖范围限制?,mapbox,openlayers,geoserver,deck.gl,Mapbox,Openlayers,Geoserver,Deck.gl,我刚刚安装了geoserver,但在运行时遇到了一些问题。我正在使用安装中提供的示例进行一些测试,特别是使用tiger:tiger\u roads。尽管我可以得到瓷砖,但当我在地图上移动时,它会在chrome控制台上抛出404错误,下一个响应是: Coverage[minx,miny,maxx,maxy]是[2411,5111,2414,5116,13],index[x,y,z]是[2410,5113,13] 我希望geoserver返回204(没有数据的ok),因为在该边界内没有任何显示 这是
tiger:tiger\u roads
。尽管我可以得到瓷砖,但当我在地图上移动时,它会在chrome控制台上抛出404
错误,下一个响应是:
Coverage[minx,miny,maxx,maxy]是[2411,5111,2414,5116,13],index[x,y,z]是[2410,5113,13]
我希望geoserver返回204(没有数据的ok),因为在该边界内没有任何显示
这是正常的行为吗?如果没有,我应该设置什么来防止该错误
这是一个完整的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>
矢量图块
html,正文{
字体系列:无衬线;
宽度:100%;
}
.地图{
高度:500px;
宽度:100%;
}
Mapbox Protobuf-矢量分幅
var style_simple=新的ol.style.style({
填充:新的ol.style.fill({
颜色:“#添加8e6”
}),
笔划:新的ol风格笔划({
颜色:“#880000”,
宽度:1
})
});
函数simpleStyle(功能){
返回方式简单;
}
变量层='tiger:tiger_roads';
风险值预测(epsg)编号='900913';
var map=新ol.map({
目标:“地图”,
视图:新ol.view({
中心:Lonlat的其他项目([-73.985130,40.758896]),
缩放:13
}),
图层:[新建ol.layer.VectorTile({
风格:简约风格,
来源:新ol.source.VectorTile({
tilePixelRatio:1,//大于1时过采样
tileGrid:ol.tileGrid.createXYZ({maxZoom:19}),
格式:新建ol.format.MVT(),
网址:'http://ec2-34-242-255-134.eu-west-1.compute.amazonaws.com:8080/geoserver/gwc/service/tms/1.0.0/“+层+
“@EPSG%3A”+projection_EPSG_no+”@pbf/{z}/{x}/{-y}.pbf”
})
})]
});
很明显,当客户端请求不存在的磁贴时,将返回404响应
错误处理
当服务器中发生错误时,客户端能够轻松地注意到发生了错误,并确定错误发生的原因,以便在必要时通知用户,这一点很重要
平铺映射服务器使用HTTP错误代码来中继错误条件的一般原因,并使用XML有效负载以人类可读的语言传达故障的具体原因
只有本规范中给出的HTTP错误代码才能用于将错误返回给客户端
- 客户端请求一个不存在的资源URL。返回HTTP错误代码404(未找到)
- 服务器无法处理有效资源URL的响应。返回HTTP错误代码500(内部服务器错误)