[OpenLayers-Users] tileStitchingPrinting problem

Greg Allensworth gregor at greeninfo.org
Thu Jun 14 08:14:11 PDT 2012


On 6/14/2012 12:40 AM, vrbikdan wrote:
> Hi all,
> sorry, but I have stupid question. I'm trying to add print functionality in
> my map. I found this code
> http://trac.osgeo.org/openlayers/wiki/TileStitchingPrinting  but I am not
> able to use it. As I understand, what I need is download Control version,
> adding it to OpenLayers.js and than what? I'm not able to figure out, how to
> implement it. Let suppose I have button "Print" and function printMap(){new
> OpenLayers.Control.TileStitchPrinter();} on click. But this do nothing. What
> I should write in this function? Should I download something else? I tried
> to find some example, but without succes :(

1. Download the OL Control from mapsportal.org and add it to your map as 
usual. Be sure to set its options as documented at the top of its source 
code; mostly you'll want printUrl

So like this:

var PRINTER = new OpenLayers.Control.TileStitchPrinter({
     printUrl:'print.php'
});
map.addControl(PRINTER);


2. At some time later, when you have your map looking good, call:
    PRINTER.print();
This part, you would usually do via an attached onClick event on some 
hyperlink or button.

You can find a working example here:
http://www.mapsportal.org/olprint/


And thanks for pointing out, that I didn't include sufficient 
documentation. I'll go in there and flesh it out right now.

-- 
Greg Allensworth, Web GIS Developer
BS  A+  Network+  Security+  Linux+  Server+
GreenInfo Network - Information and Mapping in the Public Interest
564 Market Street, Suite 510  San Francisco CA 94104
PH: 415-979-0343 x302  FX: 415-979-0371    email: gregor at greeninfo.org
Web: www.GreenInfo.org     www.MapsPortal.org

Subscribe to MapLines, our e-newsletter, at www.GreenInfo.org


More information about the Users mailing list