Example #1
0
    def _write_html_wrapper(self):
        """Write an html wrapper that embeds the geotiff in an <img> tag.
        NOTE: this cannot be viewed out-of-the-box in all browsers."""

        # replace placeholders in HTML template with filename, height, width
        # TODO(fab): read IMT from config
        html_string = template.generate_html(
            os.path.basename(self.path), 
            width=str(self.target.RasterXSize * SCALE_UP),
            height=str(self.target.RasterYSize * SCALE_UP),
            colorscale=self.colorscale_values,
            imt='PGA/g')

        with open(self.html_path, 'w') as f:
            f.write(html_string)
Example #2
0
    def _write_html_wrapper(self):
        """Write an html wrapper that embeds the geotiff in an <img> tag.
        NOTE: this cannot be viewed out-of-the-box in all browsers."""
        if self.html_wrapper:
            # replace placeholders in HTML template with filename, height,
            # width
            # TODO(fab): read IMT from config
            html_string = template.generate_html(
                os.path.basename(self.path),
                width=str(self.target.RasterXSize * SCALE_UP),
                height=str(self.target.RasterYSize * SCALE_UP),
                colorscale=self._generate_colorscale(),
                imt='PGA/g',
                template=self.html_template)

            with open(self.html_path, 'w') as f:
                f.write(html_string)
Example #3
0
    def _write_html_wrapper(self):
        """write an html wrapper that <embed>s the geotiff."""

        if self.path.endswith(('tiff', 'TIFF')):
            html_path = ''.join((self.path[0:-4], 'html'))
        else:
            html_path = ''.join((self.path, '.html'))

        # replace placeholders in HTML template with filename, height, width
        html_string = template.generate_html(
            os.path.basename(self.path),
            width=str(self.target.RasterXSize * SCALE_UP),
            height=str(self.target.RasterYSize * SCALE_UP),
            imt='Loss Ratio/percent',
            template=template.HTML_TEMPLATE_LOSSRATIO)

        with open(html_path, 'w') as f:
            f.write(html_string)