resource-watch/prep-nexgddp

View on GitHub
nexgddp/services/tile_service.py

Summary

Maintainability
A
0 mins
Test Coverage
F
50%
import mercantile


class TileService(object):
    @staticmethod
    def get_bbox(x, y, z):
        coords = list(mercantile.bounds(x, y, z))
        # [
        #     -180,
        #     -85.0511287798066,
        #     180,
        #     85.0511287798066
        # ]

        result = {
            'lat': [coords[1], coords[3]],
            'lon': [coords[0], coords[2]]
        }

        return result