maptiler/tileserver-php

VM error when fetching grid.json

heaversm opened this issue · 4 comments

Hi - I'm getting the attached
screen shot 2015-12-17 at 4 06 23 pm
console error when attempting to access my .mbtiles in javascript

The output of that json file looks like this:

screen shot 2015-12-17 at 4 06 38 pm

The error appears to be tied to these lines of code:

          //adds legend (data) to output
          $grid .= ',"data":{';
          $result = $this->db->query('SELECT key_name as key, key_json as json FROM grid_data WHERE zoom_level=' . $z . ' and tile_column=' . $x . ' and tile_row=' . $y);
          while ($r = $result->fetch(PDO::FETCH_ASSOC)) {
            $grid .= '"' . $r['key'] . '":' . $r['json'] . ',';
          }
          $grid = rtrim($grid, ',') . '}}';

Any idea what's going on or how to suppress these errors?

Not enough information to help you, I am afraid...

Is it related to legend?
Do you have a public URL where this error is visible?

The only way I could find a way to get rid of this error was to do this:

$grid .= '{"data":{';
          $result = $this->db->query('SELECT key_name as key, key_json as json FROM grid_data WHERE zoom_level=' . $z . ' and tile_column=' . $x . ' and tile_row=' . $y);
          while ($r = $result->fetch(PDO::FETCH_ASSOC)) {
            $grid .= '"' . $r['key'] . '":' . $r['json'] . ',';
          }
          $grid = rtrim($grid, ',') . '}}';

But I'm guessing if any data were returned for the grid, this would not append the data properly. Is there a better way to disregard the grid? I'm not using one, so I'm not sure why the mbtileset would be including one (or failing the check).

It was actualy bug in new versions of PHP related with change behavior of PDO response. We also have it, see: http://cynefin.archiveswales.org.uk/tileserver/cynefin-parishes/2/3/1.grid.json but our clients don't request grid tiles out of boundingbox so we could not detect this.

I found it and fix it together with another bug (f5408fd) related with last hybrid tile changes. It was hard to debug two bugs together :-(.

For future: Please turn on debuging on server. Send us your vesion of PHP etc. It will save our time.