Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable 3rd party vector tile sources #41

Closed
wants to merge 2 commits into from
Closed

Conversation

wilhelmberg
Copy link

@yhahn do you have time to review/test/merge, or tell me, whom else I should ask?
@springmeyer FYI

It's a hack, any suggestions for a clean solution are welcome

Current State

  • about to release next Mapbox Studio version
  • with the adoption of vector tiles 3rd party vector tile services will be more common and the need to style them with MBS, too.
  • MBS does not sent Accept-Encoding:gzip, because mapbox servers always send gzipped vector tiles
  • tile* modules expect gzipped vector tiles
  • 3rd party servers compress their response, depending on the presence of Accept-Encoding
  • as MBS sends requests without Accept-Encoding:gzip, servers respond with uncompressed content
  • this uncompressed response breaks tile* modules
  • just adding Accept-Encoding:gzip to requestjs header options, makes the 3rd party vector tiles work, but breaks other stuff, as uncompressed content is expected.
  • adding gzip:true to requestjs options makes the other stuff work, because requestjs decompresses on the fly, but breaks the 3rd party vector tiles as they are also decompressed before being passed to the tile* modules.

Obvious problem

If 3rd party tile services use a different extension than .pbf or .mvt

Hacky Solution

  • always send Accept-Encoding:gzip header to get gzipped responses
  • let requestjs decompress (or not) on a pre request basis (gzip:[true|false]). currently I'm checking, if
    • there is .pbf or .mvt in the url => do nothing: gzip:false
    • if not => uncompress: gzip:true

Manual tests

I tried

  • Mapbox Styles: streets, satellite, comic, ...
  • custom styles with custom source hosted by Mapbox
  • custom styles with 3rd party tile services: Mapzen and Wikimedia

Didn't ru into any problems

@wilhelmberg
Copy link
Author

Ooops, tests seem to need some care after that change.

@yhahn
Copy link
Member

yhahn commented Sep 22, 2015

@BergWerkGIS I'm merging #39 and rolling a new release based on request first. I've read your PR and have some mulling/soul searching to do...

Connection: 'Keep-Alive',
//always send gzip header, to enable 3rd party vector tile
//sources that gzip their response according to this header
//being present
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is more to follow the HTTP specification than to meet the needs of third-party sources.

springmeyer pushed a commit that referenced this pull request Jan 27, 2016
@springmeyer
Copy link

I'm working on getting out a new Mapbox Studio Classic release (motivated by having a stable base before moving Mapbox Studio Classic to producing v2 vector tiles per mapbox/vector-tile-spec#39).

My plan:

  • Create a new branch that applies the hack/fix from @BergWerkGIS to latest master
  • Point Mapbox Studio Classic at that new branch
  • Release new Mapbox Studio Classic and hope that third party tile services work
  • In the meantime I've emailed @nyurik to get details on the wikimedia endpoint so that we can eventually add tests to Mapbox Studio Classic to ensure that this functionality does not regress in Mapbox Studio Classic.

/cc @yhahn @BergWerkGIS

@springmeyer
Copy link

@yhahn - as part of the v2 spec push team @mapbox/mapnik is hitting a lot of tilelive modules. If you think it might be a good idea to get tilelive modules updated to support non-compressed tiles, let me know and we can push on that.

@springmeyer
Copy link

I'm working on getting out a new Mapbox Studio Classic release (motivated by having a stable base before moving Mapbox Studio Classic to producing v2 vector tiles per mapbox/vector-tile-spec#39).

This never happened since it was not a priority. So I think this PR can be closed.

@springmeyer springmeyer closed this Dec 3, 2018
@springmeyer springmeyer deleted the request-mbs branch December 3, 2018 02:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants