[Mapserver-users] Shape file and AUTO projection problems

Frank Warmerdam warmerdam at pobox.com
Thu Jan 15 15:08:09 EST 2004


Jay Cable wrote:
> I tried the modification, but I still get a similar results.
> 
> Digging though the mapserver code, it appears that in the case of the
> funky lines, the  projection code (pj_transform) is returning a error
> condition, which is then returned by msProjectPoint, but ignored upstream
> of msProjectPoint.  The points that fail to project are set to some
> default to (0,0), causing extra lines are drawn to the center.
> 
>>From msProjectPoint:
> <snip>
>       error = pj_transform( in->proj, out->proj, 1, 0,
>                             &(point->x), &(point->y), &z );
> 
>       if( error )
>          {
>           return MS_FAILURE;
>          }
> 
> <snip>
> 
> 
>>From msProjectLine:
> <snip>
> 	msProjectPoint(in, out, &(line->point[i]));
> <snip>
> 	msProjectPoint(in, out, &(line->point[i]));
> <snip>
> 
> I think I am going to hack the code to drop all lines that contain points
> that had projection errors.   Has anyone encountered this problem before and
> performed a similar fix?
> 
> Thanks,
>   -Jay Cable
>   jcable at gi.alaska.edu

Jay,

What version of mapproject.c are you looking at?  Back in September I
updated mapproject.c in CVS to return error codes if any points fail
to project ... that should include msProjectLine().

However, in the end I chickened out of changing msDrawShape() (or whatever
the higher level function was) so that it wouldn't draw shapes that failed
to reproject since it would result in nothing being drawn for some big shapes
even if most of it reprojected properly.  So my changes didn't prevent the
kind of corruption you are seeing.   I have a partial change to do that
in my mapserver dev directory, but I avoided committing it.

In short, mapproject.c should be fine in CVS.  If you are interested, perhaps
you could shift to the CVS version and do some testing with higher level
checks on whether various project calls have succeeded.

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