[Users] Prjection and print preview

Robert Buckley robertdbuckley at yahoo.com
Wed Aug 24 09:03:59 CEST 2011


Hi,

after reading your mail I tried out the printpreview code in a test app. This is 
something I have been meaning to do for a while now but haven´t had the time.

Anyway, I copied the code from the printpreview example 
(http://api.geoext.org/1.0/examples/print-preview.html)

and set an osm baselayer to see whether my config.yaml file works with 
OpenStreetMap. The result is that with an osm baselayer the map in the preview 
window is reduced to the size of a single pixel, but when a comment out the osm 
layer the map is ok.

here is my demo

http://maps.zgb.de/print/printpanel.html

can anyone explain to me why this is?


cheers,

Rob



________________________________
Von: gbrun <gbrun at myopera.com>
An: users at geoext.org
Gesendet: Dienstag, den 23. August 2011, 12:42:45 Uhr
Betreff: Re: [Users] Prjection and print preview

Ok, so no need to use Proj4JS to solve this problem. I only set a new  
center point for my printPage in the same projection as my map. Then, to  
display this print page at the good scale, I choose the appropriate scale  
from the print provider. And it works!

printPage = new GeoExt.data.PrintPage({
    printProvider: printProvider
});

// A layer to display the print page extent
pageLayer = new OpenLayers.Layer.Vector('printLayer');
pageLayer.addFeatures(printPage.feature);
// New coordinates to center the printPage
var lonlat = new OpenLayers.LonLat(671000, 6276000);
printPage.setCenter(lonlat);
// Add the printPage to the map and choose the appropriate scale
map.addLayer(pageLayer);
printPage.setScale(printProvider.scales.getAt(2));

I hope this will help someone.

Geoffrey


On Tue, 23 Aug 2011 08:34:59 +0200, gbrun <gbrun at myopera.com> wrote:

> Hi list!
>
> I've got a question: in my GeoExt application, I would like to the print
> functions. For this, I've already installed the GeoServer plugin
> successfully. Then, I've written some code in my application, like in  
> this
> example: http://api.geoext.org/1.0/examples/print-form.html
>
> According to firebug, there is apparently no bug. But I can't see the
> print preview. When I inspected Firebug, I saw that the features stored  
> in
> the pageLayer are defined in EPSG 4326 (I think), although my map is
> defined in a French projection.  So, I think my problem comes from this
> pageLayer projection. Am I right? Should I use Proj4JS to re-project this
> preview layer? Or is there an other easier method?
>
> Thanks for any reply!
>
> Geoffrey
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users


-- 
Using Opera's revolutionary email client: http://www.opera.com/mail/
_______________________________________________
Users mailing list
Users at geoext.org
http://www.geoext.org/cgi-bin/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20110824/eed646f7/attachment.htm 


More information about the Users mailing list