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

Add scheme option to vector source #6847

Merged
merged 1 commit into from
Jun 21, 2018
Merged

Add scheme option to vector source #6847

merged 1 commit into from
Jun 21, 2018

Conversation

mollymerp
Copy link
Contributor

@mollymerp mollymerp commented Jun 21, 2018

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
Copy link

eugeneYWang commented Jun 21, 2018

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!

Copy link
Contributor

@lbud lbud left a comment

Choose a reason for hiding this comment

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

😁

@lbud
Copy link
Contributor

lbud commented Jun 21, 2018

@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