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

Use center and zoom from style json #507

Merged
merged 2 commits into from
Mar 28, 2023
Merged

Conversation

xabbu42
Copy link
Contributor

@xabbu42 xabbu42 commented Dec 18, 2020

Use the center and zoom values from the style json as default for the center in the tilejson of the rendered map. This is especially useful for serveAllStyles where there is no other way to set this values explicitly.

@acalcutt acalcutt self-requested a review March 28, 2023 03:05
@@ -1374,6 +1374,9 @@ export const serve_rendered = {
type: 'baselayer',
};
const attributionOverride = params.tilejson && params.tilejson.attribution;
if (styleJSON.center && styleJSON.zoom) {
tileJSON.center = styleJSON.center.concat(styleJSON.zoom);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I was going to merge this, but I had issues when the zoom level was a decimal value.
image

I figured out if I added a round Math.round aound styleJSON.zoom it fixes the issue
image

Copy link
Collaborator

Choose a reason for hiding this comment

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

tileJSON.center = styleJSON.center.concat(Math.round(styleJSON.zoom)); worked

@@ -1374,6 +1374,9 @@ export const serve_rendered = {
type: 'baselayer',
};
const attributionOverride = params.tilejson && params.tilejson.attribution;
if (styleJSON.center && styleJSON.zoom) {
tileJSON.center = styleJSON.center.concat(styleJSON.zoom);
Copy link
Collaborator

Choose a reason for hiding this comment

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

tileJSON.center = styleJSON.center.concat(Math.round(styleJSON.zoom)); worked

@acalcutt acalcutt merged commit 89c6eb7 into maptiler:master Mar 28, 2023
luandro pushed a commit to digidem/tileserver-gl that referenced this pull request Mar 29, 2023
* Use center and zoom from style json as default center for tilejson of rendered maps

* Round zoom as style spec allows fractional zooms while tilejson spec does not
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants