[Mapserver-users] Shape file and AUTO projection problems

Jay Cable jcable at gi.alaska.edu
Wed Jan 14 16:17:30 EST 2004


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

On Wed, 14 Jan 2004, Le Ngoc Lam wrote:

=> I guess its projection is wrong.
=> Try modification below.
=> Regards,
=>
=> Lam
=> ---------
=>
=>
=> EXTENT -180.0 -90.0 180.0 90.0
=>   IMAGECOLOR 255 255 255
=>
=>   IMAGETYPE GIF
=>
=>   PROJECTION
=> #    "init=epsg:4318"
=>   "init=epsg:4326"
=>
=>   END
=>
=>   WEB
=>     IMAGEPATH '/home/jcable/SOFTWARE/MAPPING_STUFF/http/htdocs/tmp/'
=>     IMAGEURL '/htdocs/tmp/'
=>     LOG '/home/jcable/SOFTWARE/MAPPING_STUFF/http/htdocs/tmp/log'
=>
=>     METADATA
=>         "wms_srs"                   "EPSG:4318 AUTO:42003 AUTO:42001
=> AUTO:42002 AUTO:42004   AUTO:42008"
=>     END
=>
=>   END
=>
=>
=>   # Start of LAYER DEFINITIONS
=> ---------------------------------------------
=>   LAYER # country polygon layer begins here
=>     NAME Country
=>     DATA "/scratch/jcable/shape_files/country"
=>     STATUS DEFAULT
=>     TYPE LINE
=>
=>     PROJECTION
=> #      "init=epsg:4318"
=>   "init=epsg:4326"
=>
=>     END
=>
=>     CLASS
=>       #COLOR 232 0 0
=>       OUTLINECOLOR 232 0 0
=>     END
=>   END # country polygon layer ends here
=>   # End of LAYER DEFINITIONS -------------------------------
=>
=> END # end of map file/object
=>
=>
=>
=> ----- Original Message -----
=> From: "Jay Cable" <jcable at gi.alaska.edu>
=> To: <mapserver-users at lists.gis.umn.edu>
=> Sent: Wednesday, January 14, 2004 3:15 AM
=> Subject: [Mapserver-users] Shape file and AUTO projection problems
=>
=>
=> >
=> > Hello,
=> > I am having problems using shapefiles and the AUTO:42003 projection.  When
=> > displaying views of data the encompass the entire earth, mapserver appears
=> > to draw a lot of extra lines to the origin.
=> >
=> > Here is a sample image with this problem:
=> > http://oldlady.gina.alaska.edu/~jcable/broken.gif
=> >
=> > The problem appears to go away when the area displayed is reduced:
=> > http://oldlady.gina.alaska.edu/~jcable/working.gif
=> >
=> >
=> > I believe the shapefiles are correct, as they are sample shape files
=> > provided by ERSI.  I have also tried other shapefiles and encountered the
=> > same problem.
=> >
=> > The problem does not appear to occur with other projections I tried.
=> >
=> > Any suggestions as to how I can get around or fix this?  Am I doing
=> > something wrong?  I tried adjusting the extent with no effect.
=> >
=> > I am using mapserver 4.0, but also tried the latest 4.0.1, and it does the
=> > same thing.
=> >
=> > Thanks in advance,
=> >   -Jay Cable
=> >   jcable at gi.alaska.edu
=> >
=> > -----------------------------------------------------------------------
=> >
=> > Here is what my map file looks like:
=> >
=> >   EXTENT -180.0 -90.0 180.0 90.0
=> >   IMAGECOLOR 255 255 255
=> >
=> >   IMAGETYPE GIF
=> >
=> >   PROJECTION
=> >     "init=epsg:4318"
=> >   END
=> >
=> >   WEB
=> >     IMAGEPATH '/home/jcable/SOFTWARE/MAPPING_STUFF/http/htdocs/tmp/'
=> >     IMAGEURL '/htdocs/tmp/'
=> >     LOG '/home/jcable/SOFTWARE/MAPPING_STUFF/http/htdocs/tmp/log'
=> >
=> >     METADATA
=> >         "wms_srs"                   "EPSG:4318 AUTO:42003 AUTO:42001
=> AUTO:42002 AUTO:42004   AUTO:42008"
=> >     END
=> >
=> >   END
=> >
=> >
=> >   # Start of LAYER DEFINITIONS
=> > ---------------------------------------------
=> >   LAYER # country polygon layer begins here
=> >     NAME Country
=> >     DATA "/scratch/jcable/shape_files/country"
=> >     STATUS DEFAULT
=> >     TYPE LINE
=> >
=> >     PROJECTION
=> >       "init=epsg:4318"
=> >     END
=> >
=> >     CLASS
=> >       #COLOR 232 0 0
=> >       OUTLINECOLOR 232 0 0
=> >     END
=> >   END # country polygon layer ends here
=> >   # End of LAYER DEFINITIONS -------------------------------
=> >
=> > END # end of map file/object
=> >
=> >
=> >
=> >
=> > ****************************************************************
=> > Jay Cable                                GINA/ION
=> > tel (907) 474-1856                       Geophysical Institute
=> > jcable at gi.alaska.edu                     University of Alaska
=> >                             P.O. Box 757320
=> >                                          Fairbanks, AK 99775-7320
=> > *****************************************************************
=> > _______________________________________________
=> > Mapserver-users mailing list
=> > Mapserver-users at lists.gis.umn.edu
=> > http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
=> >
=>
=> _______________________________________________
=> Mapserver-users mailing list
=> Mapserver-users at lists.gis.umn.edu
=> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
=>



More information about the mapserver-users mailing list