[mapserver-users] Problem with polygons

Brent Wood pcreso at pcreso.com
Fri Apr 4 16:00:11 EDT 2008


Hi Kamen,

If you are using UTM projected coordinate values, defining your layer SRID as
WGS84 (EPSG:4326) in the map file doesn't seem correct.

You might also try specifying your LayerSRS tag in the OVF file to keep this
explicit.

If this is the problem, then I'm not sure why your points data would work &
polygons don't.

Brent Wood




> From: Kamen Rider <kamenriderichigo at gmail.com>
> Date: 26-mar-2008 9:51
> Subject:
> To: mapserver-users at lists.osgeo.org
>
> Hello,
> I need something specific: To draw polygons (parcels) over a SHP map, and
> none of the examples I found on the web worked.
> Also I have no problems displaying points and I'm using UTM coordinates.
>
> This is what I did:
> 
> 1.- Compiled MS on Linux (CentOS) and Install.
> MapServer version 5.0.0 OUTPUT=GIF OUTPUT=PNG OUTPUT=WBMP OUTPUT=SVG
> SUPPORTS=PROJ SUPPORTS=FREETYPE SUPPORTS=WMS_SERVER SUPPORTS=SOS_SERVER
> INPUT=EPPL7 INPUT=OGR INPUT=GDAL INPUT=MYGIS INPUT=SHAPEFILE
> 
> 2.- Installed MySql.
> 
> 3.- Created a table on MySql to store polygons. Here is the description.
> This table is called "prueba"
> +----------+---------+------+-----+---------+-------+
> | Field    | Type    | Null | Key | Default | Extra |
> +----------+---------+------+-----+---------+-------+
> | NUM      | int(11) | YES  |     | NULL    |       |
> | ID       | int(11) | YES  |     | NULL    |       |
> | poligono | text    | YES  |     | NULL    |       |
> +----------+---------+------+-----+---------+-------+
> This is what inserted on field poligono:
> POLYGON((350000 6270000,350000 6275000,360000 6275000,360000 6270000,350000
> 6270000))
> **
> 4.- Then created a OVF file, according to this example. (aqidata.ovf)
>
http://www.dottedeyes.com/web_mapping/blog/2008/02/06/how-to-display-polygons-from-non-spatial-databases/
> 
> This is my OVF file :
> 
> <OGRVRTDataSource>
>     <OGRVRTLayer name="aqidata">
> 
>
<SrcDataSource>MYSQL:test,user=root,password=xxxxx,host=localhost,port=3306,tables=prueba</SrcDataSource>
>         <SrcSQL>select NUM, ID, poligono from prueba</SrcSQL>
>         <FID>ID</FID>
>         <GeometryType>wkbPolygon</GeometryType>
>         <GeometryField encoding="WKT" field="poligono"/>
>  </OGRVRTLayer>
> </OGRVRTDataSource>
> Using OGRINFO I Tested the connection, this is the result:
> 
> INFO: Open of `/var/www/cgi-bin/tests/aqidata.ovf'
>       using driver `VRT' successful.
> 
> Layer name: aqidata
> Geometry: Polygon
> Feature Count: 1
> Layer SRS WKT:
> (unknown)
> NUM: Integer (11.0)
> ID: Integer (11.0)
> poligono: Binary (0.0)
> OGRFeature(aqidata):1
>   NUM (Integer) = 1
>   ID (Integer) = 1
>   poligono (Binary) =
> 504F4C59474F4E282833353030303020363237303030302C333530303030203632373530...
> 
> 
> 5.- Then a created a MAP file:
> 
> MAP
>   NAME "Testing"
>   EXTENT -177773.12 6409691.13 525065 6511086
>   #IMAGETYPE JPEG
>   #IMAGETYPE PNG24
>   IMAGETYPE PNG
>   IMAGECOLOR 255 255 255
>   STATUS ON
>   SIZE 400 400
>   FONTSET "fonts.txt"
>   SYMBOLSET "symbols.txt"
> 
> 
>   WEB
>     METADATA
>       "key1" "value1"
>       "key2" "value2"
>       "key3" "value3"
>       "key4" "value4"
>     END
>   END
> 
> 
>   PROJECTION
>     "init=epsg:4326"
>   END
> 
>  LAYER
>     NAME "POLIGONO"
>     DEBUG ON
>     STATUS DEFAULT
>     TYPE POLYGON
>     PROJECTION
>       "init=epsg:4326"
>     END
>     CONNECTIONTYPE OGR
>     CONNECTION "aqidata.ovf"
>  DATA "aqidata"
>     CLASS
>        NAME "MyClass"
>            STYLE
>                COLOR 0 0 0
>                OUTLINECOLOR 255 0 0
>                SIZE 8
>            END
>     END
>   END
> END
> 
> 
> It doesn't show anything, just a white rectangle. Not even an error.
> But when I display just points it works fine (using "PointsFromColumns").
> 
> I hope you could help me.
> 
> Thanks,
> 
> Pablo Molina S.
> > _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
> 



More information about the mapserver-users mailing list