为什么 Geoserver returns 404 响应具有覆盖范围限制?
Why Geoserver returns 404 response with coverage limits?
我刚刚安装了地理服务器,但在运行时遇到了一些问题。我正在使用安装时提供的示例进行一些测试,特别是 tiger:tiger_roads
。尽管我可以获得图块,但当我在地图上移动时,它会在 chrome 控制台上抛出 404
错误,下一个响应是:
Coverage [minx,miny,maxx,maxy] is [2411, 5111, 2414, 5116, 13], index [x,y,z] is [2410, 5113, 13]
我预计地理服务器 return 为 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>
TMS specification很清楚,当客户端请求一个不存在的图块时,将返回一个 404 响应。
Error Handling
When an error occurs in the server, it is important that the client be able easily notice that an error has occurred, and ascertain why the error occured so the user can be notified if necessary.
The tile map server uses HTTP error codes to relay the general reason for an error condition, and an XML payload to communicate the specific reason for the failure in human readable language.
Only HTTP error codes given in this specification should be used to return errors to the client.
The client requests a nonexistent resource URL. Return HTTP error code 404 (Not Found)
The server fails in processing a response for a valid resource URL. Return HTTP error code 500 (Internal Server Error)
我刚刚安装了地理服务器,但在运行时遇到了一些问题。我正在使用安装时提供的示例进行一些测试,特别是 tiger:tiger_roads
。尽管我可以获得图块,但当我在地图上移动时,它会在 chrome 控制台上抛出 404
错误,下一个响应是:
Coverage [minx,miny,maxx,maxy] is [2411, 5111, 2414, 5116, 13], index [x,y,z] is [2410, 5113, 13]
我预计地理服务器 return 为 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>
TMS specification很清楚,当客户端请求一个不存在的图块时,将返回一个 404 响应。
Error Handling When an error occurs in the server, it is important that the client be able easily notice that an error has occurred, and ascertain why the error occured so the user can be notified if necessary.
The tile map server uses HTTP error codes to relay the general reason for an error condition, and an XML payload to communicate the specific reason for the failure in human readable language.
Only HTTP error codes given in this specification should be used to return errors to the client.
The client requests a nonexistent resource URL. Return HTTP error code 404 (Not Found)
The server fails in processing a response for a valid resource URL. Return HTTP error code 500 (Internal Server Error)