Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions examples/render_pyramid.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from marblecutter.stats import Timer
from marblecutter.formats import PNG, GeoTIFF
from marblecutter.transformations import Normal, Terrarium
from marblecutter.transformations import GeoTIFF as GeoTIFFTransform

logging.basicConfig(level=logging.INFO)
# Quieting boto messages down a little
Expand All @@ -37,14 +38,16 @@

GEOTIFF_FORMAT = GeoTIFF()
PNG_FORMAT = PNG()

GEOTIFF_TRANSFORMATION = GeoTIFFTransform()
NORMAL_TRANSFORMATION = Normal()
TERRARIUM_TRANSFORMATION = Terrarium()


RENDER_COMBINATIONS = [
("normal", NORMAL_TRANSFORMATION, PNG_FORMAT, ".png"),
("terrarium", TERRARIUM_TRANSFORMATION, PNG_FORMAT, ".png"),
("geotiff", None, GEOTIFF_FORMAT, ".tif"),
("normal", NORMAL_TRANSFORMATION, PNG_FORMAT, ".png"),
("terrarium", TERRARIUM_TRANSFORMATION, PNG_FORMAT, ".png"),
("geotiff", GEOTIFF_TRANSFORMATION, GEOTIFF_FORMAT, ".tif"),
]


Expand Down
8 changes: 4 additions & 4 deletions marblecutter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,10 @@ def render(

# apply buffer
bounds_orig = bounds
shape = [dim + (2 * effective_buffer) for dim in shape]
bounds = [p - (effective_buffer * resolution[i % 2]) if i < 2 else
p + (effective_buffer * resolution[i % 2])
for i, p in enumerate(bounds)]
shape = tuple(dim + (2 * effective_buffer) for dim in shape)
bounds = tuple(p - (effective_buffer * resolution[i % 2]) if i < 2 else
p + (effective_buffer * resolution[i % 2])
for i, p in enumerate(bounds))

left = right = bottom = top = offset

Expand Down
4 changes: 2 additions & 2 deletions marblecutter/sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ def get_sources(self, (bounds, bounds_crs), resolution):
]

# Pick only the attributes we care about
results = [
results = (
(attr['url'], attr['source'], attr['resolution'])
for (geom, attr) in results
]
)

return results

Expand Down
3 changes: 2 additions & 1 deletion marblecutter/transformations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
# coding=utf-8
from __future__ import absolute_import

from . import hillshade, normal, terrarium
from . import geotiff, hillshade, normal, terrarium

GeoTIFF = geotiff.transformation
Hillshade = hillshade.transformation
Normal = normal.transformation
Terrarium = terrarium.transformation
17 changes: 17 additions & 0 deletions marblecutter/transformations/geotiff.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# noqa
# coding=utf-8
from __future__ import absolute_import, division, print_function

# Keeping consistent buffer with other transforms
# so that we can more effectively cache the call to mosaic.compsoite()
BUFFER = 4


def transformation():
def _transform((data, (bounds, crs))):
# GeoTIFF transform does nothing.

return (data, 'raw')

_transform.buffer = BUFFER
return _transform
5 changes: 5 additions & 0 deletions marblecutter/transformations/terrarium.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

import numpy as np

# Keeping consistent buffer with other transforms
# so that we can more effectively cache the call to mosaic.compsoite()
BUFFER = 4


def transformation():
def _transform((data, (bounds, crs))):
Expand Down Expand Up @@ -33,4 +37,5 @@ def _transform((data, (bounds, crs))):

return (np.dstack((r, g, b)), 'RGB')

_transform.buffer = BUFFER
return _transform
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
arrow
boto3
cachetools
click
flask
flask-cors
Expand Down