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 buffer on tile? #365

Closed
vincentsarago opened this issue Mar 23, 2021 · 0 comments · Fixed by #367
Closed

add buffer on tile? #365

vincentsarago opened this issue Mar 23, 2021 · 0 comments · Fixed by #367

Comments

@vincentsarago
Copy link
Member

When doing tile based machine learning, you might want to avoid edge effect. One way to work around edge effect is to add a buffer around the tile.

How to

add 👇

        tile_bounds = self.tms.xy_bounds(*Tile(x=tile_x, y=tile_y, z=tile_z))
        if buffer:
            # left, bottom, right, top
            x_res = (tile_bounds[2] - tile_bounds[0]) / tilesize
            y_res = (tile_bounds[3] - tile_bounds[1]) / tilesize
            tile_bounds = (
                tile_bounds[0] - x_res * buffer,
                tile_bounds[1] - y_res * buffer,
                tile_bounds[2] + x_res * buffer,
                tile_bounds[3] + y_res * buffer,
            )
            tilesize += buffer * 2

in

tile_bounds = self.tms.xy_bounds(*Tile(x=tile_x, y=tile_y, z=tile_z))

cc @geospatial-jeff

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 a pull request may close this issue.

1 participant