GithubHelp home page GithubHelp logo

Comments (5)

bdon avatar bdon commented on June 29, 2024

Can you share the mbtiles file?

Is it possible that the center/bounds are defaulting to the world and it just not visible at the scale when loaded in JS?

from go-pmtiles.

russss avatar russss commented on June 29, 2024

I dug into this a bit more, hopefully this explains it better:

  1. I created an .mbtiles file from a bunch of pbf files using mb-util. There was no metadata file included, so the metadata table in the resulting mbtiles database was empty.
  2. I created a .pmtiles file from this .mbtiles file, which results in the pmtiles file having a value of 0 for all the bounds. (Full pmtiles show output included below.)
  3. I try to display this pmtiles file in maplibre-js. MapLibre won't try and fetch tiles if they're outside the source's bounding box, and the pmtiles provider uses the bounds from the header of the pmtiles file, so the bounding box is [0,0,0,0], which results in the pmtiles file being silently ignored.

I'd suggest that the pmtiles command should refuse to create files with an invalid bounding box such as this, or at least issue a warning. I'd also suggest that the JS library should probably issue a warning if the pmtiles file has an invalid bounding box.

Result of `pmtiles show`
$ pmtiles show ./buildmap-nometadata.pmtiles
pmtiles spec version: 3
total size: 24 MB
tile type: Unknown
bounds: 0.000000,0.000000 0.000000,0.000000
min zoom: 7
max zoom: 20
center: 0.000000,0.000000
center zoom: 7
addressed tiles count: 12946
tile entries count: 8418
tile contents count: 5367
clustered: true
internal compression: 2
tile compression: 0

from go-pmtiles.

bdon avatar bdon commented on June 29, 2024

We can either

  1. error out when the bounds is invalid - has an area or 0, or the min is greater than max, out of the coordinate system, etc
  2. detect the error cases but default the bounds to -180,-90,180,90.

I have a slight preference for 2 because the MBTiles spec uses the SHOULD language (a valid bounds is not a hard requirement)

from go-pmtiles.

bdon avatar bdon commented on June 29, 2024

opened a PR: #77

  • If the bounds is missing from MBTiles, default it to the web mercator world -180,-90,180,90.
  • If the bounds is zero area or less, raise an error. This should catch the case you have before, in which case you need to provide corrected information in the MBTiles before converting.

from go-pmtiles.

bdon avatar bdon commented on June 29, 2024

@russss this should be resolved by https://github.com/protomaps/go-pmtiles/releases/tag/v1.10.0 which will fail if a zero-area bounds is passed, but accept no bounds. Please re-open if this is still an issue!

from go-pmtiles.

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.