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

Incorrect documentation for tileUrl with null value #95

Open
reilem opened this issue Nov 6, 2024 · 1 comment
Open

Incorrect documentation for tileUrl with null value #95

reilem opened this issue Nov 6, 2024 · 1 comment

Comments

@reilem
Copy link

reilem commented Nov 6, 2024

The docs for tileUrl state:

(optional) Tile server URL for the map base layer or null for empty base layer. {x},{y},{z} or {quadkey} supported.

However this "or null" is no longer true since version 1.11.0.

This code:

import StaticMaps from 'staticmaps';

async function main() {
    const map = new StaticMaps({
        width: 600,
        height: 600,
        tileUrl: null,
        reverseY: true,
    });

    await map.render([0, 0], 2);

    await map.image.save("map.png");
}

main();

On version 1.10.0 and before used to render an empty image where every pixel had rgba value (0,0,0,0). This was useful for creating a blank image with annotations rendered which could then be overlayed on top of other maps. However, since version 1.11.0 this now creates this image:

map

Is it still possible to create empty layers? Or has this been removed? If this feature has been removed then maybe it would be nice to add this to the release notes as a breaking change and also to update the docs. Thanks!

@reilem
Copy link
Author

reilem commented Nov 7, 2024

For those interested I found a way to get transparent maps by using a fake url that does not point to anything, e.g. "https://fake-tiles.example.com/{z}/{x}/{y}.png" this returns 404s and will result in a transparent layer.

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

No branches or pull requests

1 participant