Coder Social home page Coder Social logo

can't set minzoom=0 about mapbox-tile-copy HOT 4 OPEN

mapbox avatar mapbox commented on August 19, 2024
can't set minzoom=0

from mapbox-tile-copy.

Comments (4)

mapsam avatar mapsam commented on August 19, 2024

doesn't produce any effect

@tyrasd do you mean that there is no 0/0/0 tile generated here? I just tested with this geojson (I know, very unrealistic) and it tiles at 0/0/0 when minzoom is set to 0.

Something to keep in mind is that mapbox-tile-copy uses Mapnik when tiling - Mapnik makes some decisions about simplification that can lead to no geometry at z0, even if you specify a tile to exist at z0. The mapbox-tile-copy options for min/maxzoom only say that the library should attempt to generate a tile here, if it results in an empty tile we throw it away.

from mapbox-tile-copy.

tyrasd avatar tyrasd commented on August 19, 2024

Our use case is here: https://github.com/hotosm/osm-analytics-cruncher/blob/f2b71fc9c70e2279707e20f630a0402ce4aa2107/hotprojects.sh#L4, where we're uploading a large-ish geojson file (with high level of detail as well as global coverage) as vector tiles to s3. Using minzoom=1 everything works fine, but with minzoom=0 results only get calculated up to zoom level 6 (if I remember correctly).

I'm pretty sure conditions like https://github.com/mapbox/mapbox-tile-copy/blob/master/bin/mapbox-tile-copy.js#L42 and https://github.com/mapbox/mapbox-tile-copy/blob/master/lib/tilelivecopy.js#L52 are causing issues when the supplied value is a literal numeric 0.

from mapbox-tile-copy.

mapsam avatar mapsam commented on August 19, 2024

Ah, you're right! I tested with a case that also set info.minzoom to 0 so it didn't occur to me that options.minzoom was skipped. The following js snippets prove you are correct:

bangbang

var minzoom = 0;
var maxzoom = 15;

[minzoom, maxzoom].forEach(function(zoom) {
  if (!!zoom) {
    console.log('zoom is set to ' + zoom);
  } else {
    console.log('zoom does not exist');
  }
});

// => zoom does not exist
// => zoom is set to 15

check for defined value

var options = {
  minzoom: 0,
  maxzoom: 15
};

var minzoom = options.minzoom || 'there is no minzoom set';
var maxzoom = options.maxzoom || 'there is no maxzoom set';

console.log(minzoom); // => there is no minzoom set
console.log(maxzoom); // => 15

I think if we check for a numeric value here, i.e minzoom >= 0 we should start fixing things. I'll start working on a fix here, thanks for the report @tyrasd!

from mapbox-tile-copy.

loganpowell avatar loganpowell commented on August 19, 2024

Hi @tyrasd I'm trying to find a more streamlined workflow for setting min/maxzoom instead of using tippecanoe and ran into this issue. Did you ever find a solution?

from mapbox-tile-copy.

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.