[Users] Prjection and print preview

gbrun gbrun at myopera.com
Tue Aug 23 12:42:45 CEST 2011


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/


More information about the Users mailing list