projection problem

Ed McNierney ed at TOPOZONE.COM
Fri Dec 16 14:58:20 EST 2005


Serkan -

It is only going to be a significant case when the polygons are large
and the projections are different.  MapServer reprojects each point in
the polygon and then draws straight lines (in the output projection)
between the reprojected vertices.  When you reproject a layer so that a
straight line (in the input projection) becomes a curved line (in the
output projection), MapServer doesn't know that because it doesn't try
to inspect the interior points along the line.  If the lines are short
(as they are in most natural feature polygons) this is not a problem.
If the lines are long - as in a grid or synthetic polygon - then you may
see this symptom, especially if you're producing a small-scale output
map.

Adding more vertices is the best solution.  If MapServer (or ArcView)
had to break every line into many tiny vectors it could have a
significant performance penalty.

	- Ed

Ed McNierney
President and Chief Mapmaker
TopoZone.com / Maps a la carte, Inc.
73 Princeton Street, Suite 305
North Chelmsford, MA  01863
Phone: +1 (978) 251-4242
Fax: +1 (978) 251-1396
ed at topozone.com 

-----Original Message-----
From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] On
Behalf Of Serkan Girgin
Sent: Friday, December 16, 2005 2:51 PM
To: MAPSERVER-USERS at LISTS.UMN.EDU
Subject: Re: [UMN_MAPSERVER-USERS] projection problem

Hi Frank,

I checked the vertices and the problem is exactly as you guessed, raster
and polygon are matching at the vertices. I will try to add more
vertices to the polygon layer to solve the problem, thank you very much!
By the way, this problem should always be the case if projections of map
and data are different from each other, isn't it? Normally I would
expect that on-the-fly projection algorithms be handling such cases, but
as far as I can see this is not the case. I tried ArcView and it has the
same problem too.

Best regards,

---
Serkan Girgin
girgink at gmail.com 

-----Original Message-----
From: fwarmerdam at gmail.com [mailto:fwarmerdam at gmail.com] On Behalf Of
Frank Warmerdam
Sent: Friday, December 16, 2005 4:31 AM
To: Serkan Girgin
Cc: MAPSERVER-USERS at lists.umn.edu
Subject: Re: [UMN_MAPSERVER-USERS] projection problem

On 12/15/05, Serkan Girgin <girgink at gmail.com> wrote:
> Hi!
>
> I have a problem with on-the-fly projection and I would be grateful if

> you can help me. In my mapfile there is a raster Landsat image in UTM
projection
> (zone 37N) and a shapefile containing a polygon with the same extent 
> of
the
> raster, again in UTM projection. When I set the overall projection of 
> the mapfile to UTM these two layers coincide perfectly as expected 
> (see landsat_utm.jpg). But when I change mapfile projection to a 
> different projection, e.g. geographic or Lambert Conformal Conic, a 
> shift occurs between the layers and they do not coincide (see 
> landsat_lcc.jpg). Do you have any idea why this happens? You can find
mapfiles that I used below.

Serkan,

I'm not sure from this information, but I would guess that you get
different results because the polygon is only reprojected at the
vertices and then the new polygon is drawn "straight" between these
transformed points.  While the raster is reprojected for each pixel.  If
the polygon is big enough, this could account for the displacement.

But if this is the case, you should see the polygon match up closely
with the raster as you near one of the vertices of the polygon.

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