Skip to content
Browse files
Renamed ProjectImage and added project_shape
  • Loading branch information
philippjfr committed Nov 2, 2016
1 parent 54358ca commit c6c5ce261aa725853e00094fbe59ff3650ad1e19
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
@@ -5,12 +5,30 @@

from holoviews.operation import ElementOperation

from .element import Image

from .element import Image, Shape, Shape, Polygons, Path
from .util import project_extents

class project_shape(ElementOperation):
Projects Shape, Polygons and Path Elements from their source
coordinate reference system to the supplied projection.

projection = param.ClassSelector(default=ccrs.GOOGLE_MERCATOR,
instantiate=False, doc="""
Projection the shape type is projected to.""")

def _process_element(self, element):
geom = self.p.projection.project_geometry(element.geom(),
return element.clone(geom, crs=self.p.projection)

def _process(self, element, key=None):
return, [Shape, Polygons, Path])

class ProjectImage(ElementOperation):
class project_image(ElementOperation):
Projects an geoviews Image to the specified projection,
returning a regular HoloViews Image type. Works by
@@ -19,7 +37,8 @@ class ProjectImage(ElementOperation):

projection = param.ClassSelector(default=ccrs.GOOGLE_MERCATOR,
class_=ccrs.Projection, doc="""
instantiate=False, doc="""
Projection the image type is projected to.""")

def _process(self, img, key=None):
@@ -20,7 +20,7 @@

from ...element import (WMTS, Points, Polygons, Path, Shape, Image,
Feature, is_geographic, Text)
from ...operation import ProjectImage
from ...operation import project_image
from ...util import project_extents, geom_to_array

@@ -98,7 +98,7 @@ class GeoRasterPlot(GeoPlot, RasterPlot):
def get_data(self, element, ranges=None, empty=False):
l, b, r, t = self.get_extents(element, ranges)
if self.geographic:
element = ProjectImage(element, projection=DEFAULT_PROJ)
element = project_image(element, projection=DEFAULT_PROJ)
img = element.dimension_values(2, flat=False)
mapping = dict(image='image', x='x', y='y', dw='dw', dh='dh')
if empty:

0 comments on commit c6c5ce2

Please sign in to comment.