multiple rasters && mapview
Jonathan Coles
jonathan at jpcoles.com
Fri Jan 14 19:39:50 CET 2005
Am Freitag, den 14.01.2005, 17:37 +0100 schrieb Jan-Oliver Wagner:
> I've tried your patch and besides the visual effects I observed
> increased instead of reduced render time. I've used the profiling
> extension to measure this.
>
> In fact, the performance dramtaically goes down the deeper I zoom
> into the Iceland raster map.
yes, you are correct. i located the problem and a new patch (relative to
CVS) is listed below. the problem came up because the width and height
of the image were not calculated correctly. gdalwarp was trying to
generate a *very* large image. this new version should behave a lot
better, but i've only tested it with the iceland data and two
projections. i don't know if things will be ok with all data and all
projections.
it seems to me that a lot of time is used just converting the image.
from a few print statements and eyeballing the results, the
wxImageFromStream() call in draw_raster_data() is what is taking most
of the time. very little time is spent in the gdal or actual drawing
code.
--jonathan
RCS
file: /home/thuban/jail/thubanrepository/thuban/Thuban/UI/baserenderer.py,v
retrieving revision 1.13
diff -r1.13 baserenderer.py
372a373
>
477,480c478,507
< xmin = (0 - offx) / self.scale
< ymin = (offy - height) / self.scale
< xmax = (width - offx) / self.scale
< ymax = (offy - 0) / self.scale
---
> #xmin = (0 - offx) / self.scale
> #ymin = (offy - height) / self.scale
> #xmax = (width - offx) / self.scale
> #ymax = (offy - 0) / self.scale
>
> bb = layer.LatLongBoundingBox()
> bb = [[[bb[0], bb[1]], [bb[2], bb[3]],],]
>
> pmin, pmax = self.projected_points(layer, bb)[0]
>
> #print "**********"
> #print pmin, pmax
> #print width, height
>
> fmin = [max(0, pmin[0]) - offx, offy - min(height, pmin[1])]
> fmax = [min(width, pmax[0]) - offx, offy - max(0, pmax[1])]
>
> xmin = fmin[0]/self.scale
> ymin = fmin[1]/self.scale
> xmax = fmax[0]/self.scale
> ymax = fmax[1]/self.scale
>
> width = min(width, fmax[0] - fmin[0] + 1)
> height = min(height, fmax[1] - fmin[1] + 1)
>
> #print pmin, pmax
> #print xmin, ymin, xmax, ymax
> #print width, height
>
> #print offx, offy #, offx*self.scale, offy*self.scale
493c520
< self.draw_raster_data(data, "BMP")
---
> self.draw_raster_data(fmin[0]+offx, offy-fmax[1], data,
"BMP")
495c522
< def draw_raster_data(self, data, format="BMP"):
---
> def draw_raster_data(self, x, y, data, format="BMP"):
--
=====================================================================
Jonathan Coles http://www.jpcoles.com
jonathan at jpcoles.com GnuPG Key: /gpg_pub_key.asc
=====================================================================
More information about the Thuban-devel
mailing list
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)