[OpenLayers-Users] Value of map.getExtent() is not precise?
Pedro Simonetti Garcia
pedrosimonetti at gmail.com
Tue Apr 29 14:50:50 EDT 2008
I need a little help here. I'm developing a printing system, but I'm
problem with the extents.
I'm trying to print the map viewport, so I'm using the map.getExtent() and
map.getCurrentSize() values and passing it to the server, which calls the
mapserver and generates the image with the specified extent and size.
The problem is that the printed area is not exactly the same as showed at
the viewport. The output area is around 20% larger.
What I'm doing wrong? How can I precisely calculate the viewport extents?
The client code is something like this:
var currentSize = map.getCurrentSize();
var viewportWidth = currentSize.w;
var viewportHeight = currentSize.h;
var extent = map.getExtent();
var sPrintExtent = extent.toBBOX();
var url = 'print.php?' +
'&width=' + viewportWidth +
'&height=' + viewportHeight +
'&extent=' + sPrintExtent;
To better understand what I'm talking about, take a look at this
screenshot of my viewport:
And in the output image:
my best regards,
More information about the Users