[OpenLayers-Users] Print / Saving Image

youknowho iansgis at GMAIL.COM
Fri Mar 20 18:25:34 EDT 2009


I found the same behavior when panning before printing, and filed a bug
ticket (http://trac.openlayers.org/ticket/1813), which apparently was just
closed because it is not a bug. The review of the issue states "The wiki
printing code is the problem here. It presumably uses getLonLatFromPixel,
not getLayerPxFromLonLat like it should. this is not a bug."

I took a brief look in the Tile.js source and at lines 91-92 (for an
OpenLayers.Tile Constructor) saw:

* Parameters:
     * position - {<OpenLayers.Pixel>}
     * bounds - {<OpenLayers.Bounds>}

I wasn't able to find where/how exactly these Pixel and Bounds values are
calculated. It likely is a quick fix for the wiki printing code and I'm
happy to implement it, but I'm not familiar enough with the OL code to know
what to use in place of tile.bounds and tile.position.

Ian



Gissur Þórhallsson wrote:
> 
> Hi guys,
> I've successfully gotten those nice snippets from
> http://trac.openlayers.org/wiki/Printing working, except that if I pan,
> it's
> like the image stays in the same (incorrect) place, but the layers are
> rendered correctly.
> 
> I zoom in somewhere and print, and everything is fine:
> http://geoserver.loftmyndir.is/kortasja/print/TEMP_DIR/01e6825ce67e37ec2cc19a63bc73ed50.jpg
> 
> 
> then I pan half a screen the east and print again, getting this:
> http://geoserver.loftmyndir.is/kortasja/print/TEMP_DIR/584d8b8811bdae386a2d01a716eb1102.jpg
> 
> 
> The view I was looking at when I printed the latter image was nothing like
> what I printed out.
> 
> Anybody have any ideas?
> 
> ps. I also ran into some empty tiles problems in the printing, but I
> implemented a simple retryx3 on fail mechanism that worked wonders, should
> I
> add that to the wiki?
> 
> Kind regards,
> Gissur
> 

-- 
View this message in context: http://n2.nabble.com/Print---Saving-Image-tp1831130p2511464.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list