Search code examples
mapboxopenlayersgeoserverdeck.gl

Why Geoserver returns 404 response with coverage limits?


I have just installed geoserver, but i'm geting some trouble getting it work. I'm doing some test with the examples provided on installation, specifically with tiger:tiger_roads. Despite I can get the tile, when I move around the map, it throws 404 errors on chrome console, and the next response:

Coverage [minx,miny,maxx,maxy] is [2411, 5111, 2414, 5116, 13], index [x,y,z] is [2410, 5113, 13]

I expected that geoserver return a 204 (ok with no data), because there is nothing to display inside that bounds.

Is that a normal behaviour? If not, What Have I To set in order to prevent that error?

This is a complete index.html where you can reproduce the problem. Just open it, and move along the map, or change the zoom.

<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>

Solution

  • The TMS specification is clear that a 404 response is to be returned when a client requests an non-existent tile.

    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)