Square polygons appear as triangles

Roberto Bianconi roberto.bianconi at GMAIL.COM
Fri Feb 25 16:55:25 EST 2005


Frank,
that's exactly as you said:

Shape:13739 (Polygon)  nVertices=4, nParts=1
  Bounds:(      59.250,      74.750, 0, 0)
      to (      59.750,      75.250, 0, 0)
     (      59.250,      74.750, 0, 0) Ring
     (      59.750,      74.750, 0, 0)
     (      59.750,      75.250, 0, 0)
     (      59.250,      75.250, 0, 0)

Thank you very much.
Roberto

On Fri, 25 Feb 2005 16:07:06 -0500, Frank Warmerdam
<fwarmerdam at gmail.com> wrote:
> On Fri, 25 Feb 2005 21:54:59 +0100, Roberto Bianconi
> <roberto.bianconi at gmail.com> wrote:
> > Hi,
> > I have a shp file that describes a grid plot. It is made of adjacent
> > square polygons and when viewed out of Mapserver it is displayed
> > correctly.
> > If I try to plot it with Mapserver, with something like:
> >
> >     LAYER
> >        NAME grd
> >        STATUS DEFAULT
> >        TYPE POLYGON
> >        DATA /path_to_data/grd"
> >        CLASS
> >           EXPRESSION ([VALUE] > 1.e-5 and [VALUE] <= 1.e-4)
> >           COLOR   0 151 255
> >           OUTLINECOLOR 0 0 0
> >        END
> >        CLASS
> >           EXPRESSION ([VALUE] > 1.e-4 and [VALUE] <= 1.e-3)
> >           COLOR   0 223 255
> >           OUTLINECOLOR 0 0 0
> >        END
> >   END
> >
> > I get the square polygons represented as triangles, with a line
> > connecting the lower right corner to the upper left corner (i.e. the
> > lower left vertex is not connected). If I plot this layer - as a test
> > -  as TYPE POINT and add a CLASS vector symbol and size, I can see the
> > 4 corners of each polygon grid, each with the selected symbol.
> >
> > Where am I wrong ? Any hint on how to get the correct behaviour?
> > Thank you.
>
> Roberto,
>
> My first suspicion is that the polygons in the shapefile are not
> properly closed.  There should be five vertices for each rectangle
> as a close rectangle must have matching first and last vertices.
>
> However, your description of how it is drawn doesn't quite
> sound like I would expect.  You could inspect the file with
> shpdump or ogrinfo to see how many vertices the squares
> really have.  Lots of sloppy shapefile generating apps fail to
> close polygons.  Many apps will do it implicitly, but MapServer
> does not.
>
> Running the file through ogr2ogr may fix it up.
>
> 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