Square polygons appear as triangles

Frank Warmerdam fwarmerdam at GMAIL.COM
Fri Feb 25 16:07:06 EST 2005


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