[mapserver-users] How can I read Z coordinates in a shape file ?

Rahkonen Jukka (MML) jukka.rahkonen at maanmittauslaitos.fi
Thu Jan 8 02:26:55 PST 2015


Hi,

I would first check that your Mapserver is compiled with Z/M coordinate support which is required by reading the document http://mapserver.org/output/ogr_output.html . However, I have never played with 25D/3D geometries with Mapserver and I have no idea how to check if the Z_M support is compiled in. Perhaps there would be something about that in the comment line of GetCapabilities which typically shows something like "MapServer version 6.4.0 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG SUPPORTS=PROJ ..."

Excerpt from the WFS server manual:

ows/wfs_geomtype

    (Optional) Set the geometry type of OGR layers created from this MapServer LAYER. One of "Point", "LineString", "Polygon", "MultiPoint", "MultiLineString", "MultiPolygon", "GeometryCollection", "Geometry", or "None". Most are fairly obvious, but "Geometry" can be used to represent a mix of geometry types, and "None" is sometimes suitable for layers without geometry. Note that layers which are a mix of polygon and multipolygon would normally have to be described as "Geometry". To produce 2.5D output append "25D" to the geometry type (ie. "Polygon25D"). Note that Z values are only carried by MapServer if built with USE_POINT_Z_M support.

I would guess that it is OK in your case because you must have read the documentation well before getting as far as you are now.
My next guess is that perhaps   'wfs_getfeature_formatlist' 'OGRGML' does not remove the default outputformat which is mandated by the WFS standard and which is GML2 for WFS version 1.0.0. In that case, if you are lucky, the problem may be solved by asking Mapserver explicitly use your tailored outputformat by adding &OUTPUTFORMAT=OGRGML. If Mapserver behaves as it should you can check the GetCapabilities document and read the list of available formats from the ResultFormat section. For example this server supports only the default GML2 http://demo.mapserver.org/cgi-bin/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetCapabilities.

Despite being the last thing on my short list reading carefully the GetCapabilities document is actually the thing that should always be done first if there are some troubles with WMS/WFS/WCS services.


-Jukka Rahkonen-




Heyser Sylvain wrote:
 
> Dear Mapserver community,

> I try to read the value of the Z coordinate in an Esri Shape file without success.

> I want to get the Z values through an url request (WFS) like this : 
http://my_server_ip/cgi-bin/mapserv?map=/var/www/data/mapfile.map&SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&SRS=EPSG:3163&BBOX=458692.315380274,394716.36951207,460607.98862158,395413.707691068&TYPENAME=Piste

> But I only get output data without Z values.
<gml:featureMember><ms:Piste fid="Piste.1"><gml:boundedBy><gml:Box
srsName="EPSG:3163"><gml:coordinates>459689.471118,394821.251944
459699.341118,394828.476944</gml:coordinates></gml:Box></gml:boundedBy><ms:msGeometry><gml:LineString
srsName="EPSG:3163"><gml:coordinates>459699.341118,394821.251944
459693.717118,394828.476944 459689.471118,394825.098944 </gml:coordinates></gml:LineString></ms:msGeometry><ms:PISTAER_ID>1</ms:PISTAER_ID></ms:Piste></gml:featureMember><gml:featureMember>


> The OGRINFO of the data is :
Layer name: PISTAERO_line
Geometry: 3D Line String
Feature Count: 2
Extent: (459349.927521, 394583.151000) - (460037.901778, 395483.896917) Layer SRS WKT:
(unknown)
PISTAER_ID: Integer (5.0)

I have configure my map file as follow :
MAP
     NAME DACDEV_map
     STATUS ON
     SIZE 900 700
     EXTENT 150000 150000 650000 650000
     UNITS METERS
     SHAPEPATH "shape"
     IMAGECOLOR 255 255 0
     SYMBOLSET "symbols-dac.sym"
     PROJECTION
         'init=epsg:3163'
     END

     CONFIG 'MS_ERRORFILE' '/var/www/tmp/ms_error.log'

     OUTPUTFORMAT
         NAME "OGRGML"
         DRIVER "OGR/GML"
         FORMATOPTION "STORAGE=filesystem"
         FORMATOPTION "FORM=multipart"
         FORMATOPTION "FILENAME=/var/www/tmp/result.gml"
     END

     WEB
         TEMPLATE "template.html"
         IMAGEPATH "/var/www/tmp/"
         IMAGEURL "/tmp/"
         METADATA
             'wms_title'           'DAC_DATA'
             'wms_srs'             'EPSG:3163'
             'wfs_title'           'DEMO'
             'wfs_olineressource' 'http://192.168.10.108/cgi-bin/mapserv?'
             'wfs_srs'             'EPSG:3163'
             'wfs_enable_request'  '*'
         END
     END

    LAYER
         NAME "Piste"
         DEBUG 5
         METADATA
             'wfs_title'           'Piste'
             'wfs_srs'             'EPSG:3163'
             'gml_featureid'       'PISTAER_ID'
             'gml_include_items'   'all'
             'wfs_enable_request'  '*'
             'wms_enable_request'  '*'
             'ows_geomtype'          'LineString25D'
             'wfs_geomtype'          'LineString25D'
             'wfs_getfeature_formatlist' 'OGRGML'
         END
         CONNECTION "PISTAERO_line.shp"
         CONNECTIONTYPE OGR
         DATA 'PISTAERO_line'
         STATUS ON
         DUMP true
         TYPE LINE25D
         CLASS
             NAME "line_color"
             COLOR 255 215 0
         END
     END
END

> I don't understand why the /var/www/tmp/result.gml file is never created. It looks like that the OGRGML OUTPUTFORMAT is not used by mapserv.

Kind regards,
Sylvain

_______________________________________________
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