Skip to content

Add scheme option to vector source - #6847

Merged
mollymerp merged 1 commit into
mb-pagesfrom
vector-scheme
Jun 21, 2018
Merged

mollymerp merged 1 commit into
mb-pagesfrom
vector-scheme

Conversation

@mollymerp

@mollymerp mollymerp commented Jun 21, 2018 •

Copy link
Copy Markdown
Contributor

this is already implemented:

extend(this, pick(options, ['url', 'scheme', 'tileSize']));

and tested:

function testScheme(scheme, expectedURL) {
t.test(`scheme "${scheme}"`, (t) => {
const source = createSource({
minzoom: 1,
maxzoom: 10,
attribution: "Mapbox",
tiles: ["http://example.com/{z}/{x}/{y}.png"],
scheme: scheme
});
source.dispatcher.send = function(type, params) {
t.equal(type, 'loadTile');
t.equal(expectedURL, params.request.url);
t.end();
};
source.on('data', (e) => {
if (e.sourceDataType === 'metadata') source.loadTile({
tileID: new OverscaledTileID(10, 0, 10, 5, 5)
}, () => {});
});
});
}
testScheme('xyz', 'http://example.com/10/5/5.png');
testScheme('tms', 'http://example.com/10/5/1018.png');

just not documented 📝

ref #2565 (comment)

Launch Checklist

  • briefly describe the changes in this PR

@mollymerp
mollymerp requested a review from lbud June 21, 2018 21:54
@eugeneYWang

eugeneYWang commented Jun 21, 2018 •

Copy link
Copy Markdown

Thank you for opening an PR! If someone in Mapbox, I knew Lauren contributed a bit, is contributing to the type library of mapbox-gl, would you give him/her a poke to support this TMS scheme about Vector tile in the type library of mapbox-gl?

Thank you again!

@lbud lbud left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

😁

@lbud

lbud commented Jun 21, 2018

Copy link
Copy Markdown
Contributor

@eugeneYWang the Mapbox team officially does not maintain the community-maintained TypeScript definitions, but someone from the community could definitely contribute a PR there if interested! (At a glance it looks like there are a few other keys — bounds, attribution — missing from the VectorSource definition as well.)

@mollymerp
mollymerp merged commit 7b71a61 into mb-pages Jun 21, 2018
@mollymerp
mollymerp deleted the vector-scheme branch June 22, 2018 05:23
mollymerp pushed a commit that referenced this pull request Jul 28, 2018
mollymerp pushed a commit that referenced this pull request Jul 28, 2018
mollymerp pushed a commit that referenced this pull request Jul 30, 2018
mollymerp pushed a commit that referenced this pull request Jul 30, 2018
mollymerp pushed a commit that referenced this pull request Jul 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants