accuracy of raster maps
Frank Warmerdam
warmerdam at POBOX.COM
Wed Aug 18 12:18:30 PDT 2004
Jan Hartmann wrote:
> Hi,
>
> Has anyone seen this before? I am georeferencing old cadastral maps and
> have two layers in my map: the original scan (a raster layer with a
> world file), and the reference points in a PostGIS database. Both are
> the same local coordinate systems (0/0 - 4000/4000). On the first image
> you see the green reference point lying over the black raster reference
> lines. When zooming in further, (image2.gif), you see that the reference
> point is somewhat to the left of the line. However, when panning the
> image (image3.gif), the reference point has moved *over* the reference
> line. Every further pan gives a slightly different position of the point
> versus the raster. Differences are within the size of one pixel, but
> they are irriting in a georeferencing application.
>
> I can't see what I am doing wrong: both layers are in the same MapFile,
> so when I change the map extent for zooming or panning, they should not
> move relative to each other. My impression is that the point is rendered
> exactly, but that the raster gets moved (rounding off error?) Any idea
> what's going on here?
Jan,
The general raster renderer in MapServer transforms the request window
into a pixel/line window on the source file and loads and stretches that
window. The way this is done, all pixels in the selected window will be
drawn with the same size (give or take a pixel depending on rounding).
In cases such as yours (with extreme zoom in) you really want to do all the
calculations on a subpixel level, so if the map edge falls in the middle of
a pixel, only half that pixel would be displayed. However, that isn't done.
On the good side, I think you would get the proper results if you could
force things to go through the image warping code used for transforming
between projections. This code does effectively do all the calculations
at a subpixel level.
There isn't currently a keyword or anything to force use of the warping
code in preference to the simple stretch code, but I have successfully
tricked mapserver into using it before by specifying coordinate systems
for the map and the raster layer that differ in some very small way.
For instance, a very subtle difference in datum shift.
eg.
+proj=utm +zone=11 +ellps=GRS80 +towgs84=0,0,0
and
+proj=utm +zone=11 +ellps=GRS80 +towgs84=0,0,0.001
Try triggering the warping logic and let me know if it seems to
improve display. Note that the warping logic will be slower than
the simple case, often roughly doubling map rendering time.
I am thinking it might be useful for me to add a special keyword to
force use of the warper, likely via a PROCESSING directive.
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent
More information about the MapServer-users
mailing list