Coder Social home page Coder Social logo

Comments (1)

mapsam avatar mapsam commented on August 19, 2024

Hi @jliebrand - thanks for the question! Knowing where your tiles are, and if they are updated, is outside the scope of this library (and the vector tile specification, which this adheres to). That said, you're on the right track with moving everything to a new s3 prefix (not saying this is the only way). I'd suggest having some sort of intermediate service in the API request that knows where your tilest lives on s3. The HTTP request remains the same but your API internals GET from an updated s3 prefix.

So for example (this has a lot of assumptions):

Let's say you have a tileset called neat-tileset. The first time you copy tiles to s3 you run the following command you could add a customized prefix to the s3 location, like v1:

mapbox-tile-copy neat-data.geojson s3://bucket/neat-tileset/v1/{z}/{x}/{y}

So when you request a tile through your API with the following URL

https://api.example.com/neat-tileset/0/0/0.mvt

Your API would see that request and have some sort of knowledge of where on S3 the neat-tileset tiles live. Let's say it's a TILESET_PREFIX variable set to v1. You're able to get the tile from that s3 bucket/prefix and return it.

Then you make a change to the source data and update neat-tileset. You may go to v2 and use the following command:

mapbox-tile-copy neat-data.geojson s3://bucket/neat-tileset/v2/{z}/{x}/{y}

At this point, the last big change you'll have to do is update your TILESET_PREFIX to be set to v2 so you're grabbing tiles from the new location.

Drawbacks?

Certainly. Depending on the API that is built and service you are using you'll want to figure out how to set expire tags and content headers so any sort of cache will notice this being a new request and not an old v1 request. Storage costs can become a factor if you do this at scale, and determining where TILESET_PREFIX lives and how it is updated can be challenging. But I'll leave those decisions to you :)


Going to close this since as I mentioned before, the feature is out of scope of this library.

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.