Coder Social home page Coder Social logo

Comments (13)

hyperknot avatar hyperknot commented on June 2, 2024 1

I think this nginx block should take care of it, but I need a bit more testing:

location /.../ {
    alias ...;
    try_files $uri $uri/ @empty;
}

location @empty {
    default_type text/plain; # TODO
    return 200 "''";
}

from planetiler.

hyperknot avatar hyperknot commented on June 2, 2024 1

I'm not sure how browsers, proxies, CloudFlare, etc. handle 204 requests.
I'd like to replicate the behaviour of the reference implementation

The reference implementation + https://github.com/consbio/mbtileserver returns 200 with content-type: application/x-protobuf

(tested on /14/0/16284.pbf and /14/0/16247.pbf)

from planetiler.

hyperknot avatar hyperknot commented on June 2, 2024

It's interesting that these number are more or less consistent between a run today and one done 2 months ago.

sqlite> select count(*) from tiles_shallow where zoom_level = 1;
4
sqlite> select count(*) from tiles_shallow where zoom_level = 2;
16
sqlite> select count(*) from tiles_shallow where zoom_level = 3;
64
sqlite> select count(*) from tiles_shallow where zoom_level = 4;
256
sqlite> select count(*) from tiles_shallow where zoom_level = 5;
1024
sqlite> select count(*) from tiles_shallow where zoom_level = 6;
4096
sqlite> select count(*) from tiles_shallow where zoom_level = 7;
13986
sqlite> select count(*) from tiles_shallow where zoom_level = 8;
55100
sqlite> select count(*) from tiles_shallow where zoom_level = 9;
217779
sqlite> select count(*) from tiles_shallow where zoom_level = 10;
853600

from planetiler.

msbarry avatar msbarry commented on June 2, 2024

In the openmaptiles profile, "land" is indicated by absence of any data, and planetiler doesn't empty tiles so the counts dropping starting at z7 are from entire tiles being excluded from the output (probably starting in antarctica).

Also FYI you should upgrade to java 21 - newer versions of planetiler won't work with java 17 anymore.

from planetiler.

hyperknot avatar hyperknot commented on June 2, 2024

So with a decent client lib it should just work correctly, right? Thanks for the java 21 hint, I didn't see the update 2 month ago.

from planetiler.

pnorman avatar pnorman commented on June 2, 2024

In the openmaptiles profile, "land" is indicated by absence of any data

Land and the absence of data would be a zero-byte tile, not the absence of a tile.

from planetiler.

msbarry avatar msbarry commented on June 2, 2024

Right, the translation from "no data" to zero-byte tile needs to happen at some point in the stack. A tile server like tileserver-gl will return a 204 response when the tile is missing from the underlying data source. The pmtiles javascript client passes an empty byte array to maplibre when the tile is missing from the index, and maplibre-gl handles a 404 as no data.

from planetiler.

hyperknot avatar hyperknot commented on June 2, 2024

Do you mean what's missing is a zero byte file? I'll be serving this directly, from the filesystem, without any tile server.
So basically I need to make sure that all 404s are returned as an empty string and 200?

from planetiler.

msbarry avatar msbarry commented on June 2, 2024

What client are you be using?

from planetiler.

hyperknot avatar hyperknot commented on June 2, 2024

I want to make it compatible with every client which works with the reference implementation (for example Mapbox GL JS 1.x, etc.). So I need to do this server side.

from planetiler.

msbarry avatar msbarry commented on June 2, 2024

Would return 204; work?

from planetiler.

pnorman avatar pnorman commented on June 2, 2024

Do you mean what's missing is a zero byte file? I'll be serving this directly, from the filesystem, without any tile server. So basically I need to make sure that all 404s are returned as an empty string and 200?

Directly from the filesystem? If so, then you actually need the 0 byte files. If you're serving it not directly, but with a HTTP server between the tiles and the client, then you could transform missing files into zero byte 2xx responses. You'll just have to be careful about distinguishing between tiles that are missing because they're really 0-byte tiles, tiles that are missing because they're invalid (e.g. 0/1/2 or 0/1/-1), URLs that aren't tiles at all, and tiles outside your zoom range and bounding box.

returns 200 with content-type: application/x-protobuf

As per the specification, the MIME type SHOULD be application/vnd.mapbox-vector-tile

from planetiler.

hyperknot avatar hyperknot commented on June 2, 2024

Yes, I meant that nginx will be serving them directly from the filesystem, without any tile server running. Thank you for the explanation, I understand it now and will update the MIME type.

from planetiler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.