[OpenLayers-Users] Strange issue using custom printing tool

David Alda Fernandez de Lezea dalda at ikt.es
Wed Mar 2 11:03:34 EST 2011


Hi,

We manage to create a custom print tool for OpenLayers. The tool is based in the code that appears in http://trac.osgeo.org/openlayers/wiki/Printing but with some little changes to provide the print-server-script also the vector feature of openlayers. The tool is working fine but I've detected a small malfunctioning of printing code. Sometimes some tiles are lost if you pan instead of zoomming. To reproduce the malfunctioning follow these steps:

1- Zoom to an area, e.g. zoom level 5-6.
2- Click the print icon 
3- A pop up will appear with the generated image
4- Activate the pan tool and pan more than one time to move from that area to another one.
5- Again, Click the print icon
6- The generated image has som blanks tiles

This issue it doesn't happen if you zoom in and zoom out after panning, weird, isn't it?

I've been debugging with FireBug and the only thing I see strange is that while looping through the layer.grid array:

....

// iterate through their grid's tiles, collecting each tile's extent and pixel location at th
						for (tilerow in layer.grid) {
							for (tilei in layer.grid[tilerow]) {
								if (tilei != "bindAsEventListener" && tilei != "bind" && tilei != "indexOf"){
									var tile = layer.grid[tilerow][tilei]
									//if (map.getExtent().containsBounds(tile.bounds)){
										var url = layer.getURL(tile.bounds);
										var position = tile.position;
										var opacity = layer.opacity ? parseInt(100*layer.opacity) : 100;
										tiles[tiles.length] = {'url':escape(url), 'x':position.x, 'y':position.y, 'opacity':opacity};
									//}
								}
							}
						}

....

The value of position.X during the issue it can reach until 2456, for example, but whe working correctly it doesn't appear to be very large.

To test this behaviour:

http://www.iktlan.net/mapa/OpenLayers/visorIKT.htm

Any ideas?? 
 
Un saludo,
 
··················································································

David Alda Fernández de Lezea
Lurralde eta Biodibertsitate Saila / Dpto. de Territorio y Biodiversidad
 
IKT
Granja Modelo s/n · 01192 · Arkaute (Araba)

··················································································
Tlfnos.: 945-00-32-95                         Fax: 945-00.32.90
··················································································
email: dalda at ikt.es                                web: www.ikt.es
··················································································


More information about the Users mailing list