[mapserver-users] wfs problem <gml:null>missing</gml:null>

dstroeer at uni-osnabrueck.de dstroeer at uni-osnabrueck.de
Sat Dec 17 09:33:29 EST 2011


Hello,

I'm testing a WFS-Layer in OpenLayers.  So first of all I set up a WFS in
epsg:4326. You can see the mapfile below...
Now I want to put his WFS into a OpenLayers project. Here we've got a
simple OpenStreetMap WMS, also in epsg:4326. But when I'm testing my
OpenLayers application (code below), I don't see my WFS layer.

So I'm using firebug and I can see that OpenLayers tries the following
request:

http://localhost/cgi-bin/mapserv.exe?map=C:/ms4w/Apache/htdocs/mapserverII/wms_wfs/wfs_ogc/wfs_server_4326.map&TYPENAME=Testdatenlayer&SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&SRS=EPSG%3A4326&BBOX=3.60546875,50.802734375,12.39453125,55.197265625

When I try this request in Firefox, I'm getting the following result:

<wfs:FeatureCollection xsi:schemaLocation="http://www.opengis.net/wfs
http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd                        
http://mapserver.gis.umn.edu/mapserver
http://localhost/cgi-bin/mapserv.exe?map=C:/ms4w/Apache/htdocs/mapserverII/wms_wfs/wfs_ogc/wfs_server_4326.map&SERVICE=WFS&VERSION=1.0.0&REQUEST=DescribeFeatureType&TYPENAME=Testdatenlayer&OUTPUTFORMAT=XMLSCHEMA"><gml:boundedBy><gml:null>missing</gml:null></gml:boundedBy></wfs:FeatureCollection>


When I'm cutting the BBOX parameter like this

http://localhost/cgi-bin/mapserv.exe?map=C:/ms4w/Apache/htdocs/mapserverII/wms_wfs/wfs_ogc/wfs_server_4326.map&TYPENAME=Testdatenlayer&SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&SRS=EPSG%3A4326

I can see a list of my features:
...
<gml:boundedBy><gml:Box
srsName="EPSG:4326"><gml:coordinates>3449790.000000,5891640.000000
3470274.000000,5940811.000000</gml:coordinates></gml:Box></gml:boundedBy><gml:featureMember><ms:Testdatenlayer
fid="Testdatenlayer.1"><gml:boundedBy><gml:Box
srsName="EPSG:4326"><gml:coordinates>3463543.000000,5900876.000000
3463543.000000,5900876.00000
...

It seems to be a projection problem, but I don't know where...
So now I want to ask if there are any problems with my mapfile or if I
made another mistake?

Thanking you in anticipation,

D. Stroeer


##########################    mapfile   ###########################

MAP
  NAME                 'Testkarte WFS'
  STATUS               ON
  IMAGETYPE            PNG
  #EXTENT              3430018 5876533 3491970 5948485
  EXTENT               7.855 53.034 8.866 53.646
  UNITS                meters
  SIZE                 500 500
  IMAGECOLOR           220 220 220
  SHAPEPATH             
'C:/ms4w/Apache/htdocs/mapserverII/wms_wfs/wfs_ogc/data/'
  SYMBOLSET              
'C:/ms4w/Apache/htdocs/mapserverII/wms_wfs/wfs_ogc/symbols/symbols.sym'
  FONTSET               
'C:/ms4w/Apache/htdocs/mapserverII/wms_wfs/wfs_ogc/fonts/fonts.list'

WEB
    TEMPLATE             'template.html'
    IMAGEPATH            'C:/ms4w/Apache/htdocs/tmp/'
    IMAGEURL             '/tmp/'
  METADATA
    "WFS_TITLE"        "WFS-Test"
    "WFS_SRS"          "epsg:4326"
    "WFS_ABSTRACT"     "Ein kleiner WFS-Test"
    "WFS_ONLINERESOURCE"
"http://localhost/cgi-bin/mapserv.exe?map=C:/ms4w/Apache/htdocs/mapserverII/wms_wfs/wfs_ogc/wfs_server_4326.map"
    "wfs_enable_request" "*"  # necessary
  END
END

PROJECTION
     "init=epsg:4326"
END

    LAYER
        PROJECTION
          'init=epsg:4326'
        END
        SYMBOLSCALE 50000
        NAME         'Testdatenlayer'
        TYPE         POINT
        TOLERANCE   5
        STATUS    ON
        DATA 'testdaten_4326.shp'
        DUMP TRUE
        METADATA
          "WFS_TITLE" "Testdaten"
          "WFS_SRS" "epsg:4326"
          "gml_featureid" "id"
          "GML_INCLUDE_ITEMS" "all"
        END
        CLASS
          STYLE
            SYMBOL    'square'
            COLOR     200 0 0
            SIZE 9
            MINSIZE 9
            MAXSIZE 15
          END
        END
    END
END


######################   OpenLayers Application    ########################

    <script src="../lib/OpenLayers.js"></script>
    <script type="text/javascript">
        var lon = 8;
        var lat = 53;
        var zoom = 8;
        var map, layer;


        function init(){


            map = new OpenLayers.Map( 'map');

            layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
                    "http://vmap0.tiles.osgeo.org/wms/vmap0", {layers:
'basic'}
            );


              var weserwfs = new OpenLayers.Layer.WFS(
                "WFS-Test",
                "http://localhost/cgi-bin/mapserv.exe?map=C:/ms4w/Apache/htdocs/mapserverII/wms_wfs/wfs_ogc/wfs_server_4326.map",
                {typename: 'Testdatenlayer'},


                   {
      extractAttributes: true,
     styleMap: new OpenLayers.StyleMap({
        pointRadius: 8,
        fillColor: '#ee0000',
        fillOpacity: 0.5,
        strokeColor: '#ee0000',
        strokeOpacity: 1,
        strokeWidth: 3
      })
    }
    );



            map.addLayer(layer);

            map.addLayer(weserwfs);


            map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);

            map.addControl( new OpenLayers.Control.LayerSwitcher() );
            map.addControl( new OpenLayers.Control.OverviewMap() );
            map.addControl( new OpenLayers.Control.ScaleLine() );
            map.addControl( new OpenLayers.Control.MousePosition() );
        }
    </script>


More information about the mapserver-users mailing list