Skip to content

Allow drawing empty base layer#61

Merged
StephanGeorg merged 2 commits intoStephanGeorg:masterfrom
Sitemark:allow-empty-base-layer
Nov 15, 2021
Merged

Allow drawing empty base layer#61
StephanGeorg merged 2 commits intoStephanGeorg:masterfrom
Sitemark:allow-empty-base-layer

Conversation

@OlivierKamers
Copy link
Copy Markdown
Contributor

We have a special use-case where it's useful to allow drawing annotations without having a base-layer.

Some of our map layers have thermal data meaning that the data is encoded in the RGB values of the tiles and has to be decoded to a visual coloring again. We draw the base layer using staticmaps, read the resulting image and apply the coloring to the pixels.

When adding drawings (lines, polygons, text, ...) this would mean that the drawings get this different coloring too. That's why we render them separately with a staticmaps instance without base layer and in the end add it as an overlay to the colored map layer (using sharp).

@StephanGeorg
Copy link
Copy Markdown
Owner

Thank's again for your PRs @OlivierKamers. Use case sounds reasonable to me. Would you please add a test for this. Thanks.

@OlivierKamers
Copy link
Copy Markdown
Contributor Author

@StephanGeorg I have added a test case which results in the expected image:
05-annotations-nobaselayer

However when running all tests locally, all other test cases seem to fail because the tile request returns a response with an empty buffer, even though the URL looks ok. I also have this when running them on the main branch so it shouldn't be an issue with this change.

@StephanGeorg StephanGeorg merged commit 44c6064 into StephanGeorg:master Nov 15, 2021
@StephanGeorg
Copy link
Copy Markdown
Owner

However when running all tests locally, all other test cases seem to fail because the tile request returns a response with an empty buffer, even though the URL looks ok. I also have this when running them on the main branch so it shouldn't be an issue with this change.

Seams to be something with your IP. All tests running smoothly from my local machine.

@OlivierKamers OlivierKamers deleted the allow-empty-base-layer branch June 17, 2022 11:57
@OlivierKamers
Copy link
Copy Markdown
Contributor Author

Just posting here that I found the issue with the empty response body, which is actually documented here: sindresorhus/got#1349
My default node version was 14.1.0, updating it solved the issue!
Our other project (which uses staticmaps) didn't show the bug because we specify a more recent node version in the package.json file.

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.

2 participants