[OpenLayers-Users] Value of map.getExtent() is not precise?
Pedro Simonetti Garcia
pedrosimonetti at gmail.com
Tue Apr 29 15:01:25 EDT 2008
Sorry,
My free host is really bad, and the image sometimes will not download.
I've uploaded those images to my googlepages:
http://pedrosimonetti.googlepages.com/viewport.JPG
http://pedrosimonetti.googlepages.com/print.jpg
regards,
Pedro Simonetti.
2008/4/29 Pedro Simonetti Garcia <pedrosimonetti at gmail.com>:
> Hi all,
>
> I need a little help here. I'm developing a printing system, but I'm
> getting some
> 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?' +
> 'size=custom' +
> '&width=' + viewportWidth +
> '&height=' + viewportHeight +
> '&extent=' + sPrintExtent;
>
> window.open(url);
>
>
> To better understand what I'm talking about, take a look at this
> screenshot of my viewport:
> http://jproton.com.br/sandbox/viewport.JPG
>
> And in the output image:
> http://jproton.com.br/sandbox/print.jpg
>
>
> my best regards,
>
> Pedro Simonetti.
>
More information about the Users
mailing list