[OpenLayers-Users] WFS Data Truncated

Rob McCulley RMcCulley at county24.com
Thu May 2 13:16:59 PDT 2013


Hi All,

I'm trying to display a WFS layer from mapserver in OpenLayers.  It's running Mapserver version 6.2.0, and the data is stored in a postgis database (postgis 2.0 in postgres 9.1).

The problem I'm having is that the XML response is always truncated in OpenLayers.  I've testing in QGIS and by doing a GetFeature request, and both of these work properly, so the problem appears to be with my OpenLayers setup.

Here is the html:

<html>
<head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <title>WFS Testing</title>
      <link rel="stylesheet" href="theme/default/style.css" type="text/css">
      <script src="lib/OpenLayers-2.12.js"></script>
      <script type="text/javascript">
      var map;
      function init() {
               var options = {
                   bgcolor:'transparent',
                   units:'m',
                   allOverlays: true,
                   maxExtent:new OpenLayers.Bounds(497444,5856659,566948,5971683),
                   projection: new OpenLayers.Projection("EPSG:26912"),
                   displayProjection:new OpenLayers.Projection("EPSG:26912"),
                   controls:[
                             new OpenLayers.Control.Navigation({}),
                             new OpenLayers.Control.LayerSwitcher({})
                             ]
               };
               map = new OpenLayers.Map('map',options);
               var aerial11 = new OpenLayers.Layer.WMS("2011 Aerial","http://gpsserver/cgi-bin/mapserv.exe?map=cvr.map&",{layers:"aerial2011-county"});
               var pe = new OpenLayers.Layer.Vector("PE",
{strategies:[new OpenLayers.Strategy.BBOX()],
protocol: new OpenLayers.Protocol.WFS({url: "http://gpsserver/cgi-bin/mapserv.exe?map=cvr.map&",
featureType:"PE",featurePrefix:"ms"
})
});
               map.addLayers([aerial11,pe]);
               map.setCenter(new OpenLayers.LonLat(514237.9,5900043.1), 6);
      }
      </script>
</head>
<body onload="init()">
      <div id="map" style="width:800px;height:800px;"></div>
</body>
</html>

The Mapfile looks like:

MAP
    NAME "Map"
    STATUS ON
    EXTENT 465915 5856658 598477 5971684
    UNITS METERS
    IMAGECOLOR 255 255 255
    TRANSPARENT TRUE
    FONTSET " fonts.list"
    CONFIG "PROJ_LIB" "C:/OS/nad/"
    SYMBOLSET " symbol.sym"
    WEB
        IMAGEPATH "C:/OS/Apache2.2/htdocs/tmp/"
        IMAGEURL "http://gpsserver/tmp/"
        METADATA
            "ows_title"          "CVR OGC Server"
            "ows_onlineresource" "http://gpsserver/cgi-bin/mapserv.exe?map=cvr.map&"
            "ows_srs"            "EPSG:26912"
            "ows_enable_request" "*"
        END
    END
    PROJECTION
        "init=epsg:26912"
    END
    LAYER
        NAME 'PE'
        TYPE LINE
        STATUS ON
        CONNECTION "host=localhost dbname=cvr3 user=read_only password=read_only port=5432"
        CONNECTIONTYPE postgis
        DATA "shape FROM (SELECT gas.lines.id AS oid, gas.lines.shape AS shape FROM gas.lines JOIN domains.materials ON gas.lines.material = domains.materials.id JOIN domains.status ON gas.lines.status = domains.status.id WHERE domains.status.status = 'Active' AND domains.materials.material = 'PE') AS foo USING UNIQUE oid USING SRID=26912"
        CLASS
            STYLE
                COLOR 255 255 0
                WIDTH 2
            END
        END
        METADATA
            "ows_title"  "PE"
            "ows_extent" "465915 5856658 598477 5971684"
            "ows_srs" "EPSG:26912"
            "gml_include_items" "all"
            "gml_featureid" "id"
        END
        PROJECTION
            "init=epsg:26912"
        END
    END
END

According to firebug, the request  is:

<wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" service="WFS" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd<http://www.opengis.net/wfs%20http:/schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd>" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<wfs:Query typeName="ms:PE">
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
<ogc:BBOX>
<ogc:PropertyName>the_geom</ogc:PropertyName>
<gml:Box xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:26912">
<gml:coordinates decimal="." cs="," ts=" ">513109.01172072,5898914.2117208 515366.78827928,5901171.9882792</gml:coordinates>
</gml:Box>
</ogc:BBOX>
</ogc:Filter>
</wfs:Query>
</wfs:GetFeature>

And the response is:

<?xml version='1.0' encoding="ISO-8859-1" ?>
<wfs:FeatureCollection
   xmlns:ms="http://mapserver.gis.umn.edu/mapserver"
   xmlns:wfs="http://www.opengis.net/wfs"
   xmlns:gml="http://www.opengis.net/gml"
   xmlns:ogc="http://www.opengis.net/ogc"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   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=cvr.map&SERVICE=WFS&VERSION=1.0.0&REQUEST=DescribeFeatureType&TYPENAME=ms:PE&OUTPUTFORMAT=XMLSCHEMA">
      <gml:boundedBy>
         <gml:Box srsName="EPSG:26912">
                 <gml:coordinates>514106.777801,5899166.840702 515484.051885,5901378.470676</gml:coordinates>
         </gml:Box>
      </gml:boundedBy>
<!-- WARNING: FeatureId item 'id' not found in typename 'PE'. -->
    <gml:featureMember>
      <ms:PE>
        <gml:boundedBy>
        <gml:Box srsName="EPSG:26912">
                 <gml:coordinates>514106.777801,5900005.903392 514156.626532,5901378.470676</gml:coordinates>
        </gml:Box>
        </gml:boundedBy>
        <ms:msGeometry>
        <gml:LineString srsName="EPSG:26912">
          <gml:coordinates>514151.324921,5901378.470676 514106.777801,5901374.096198 514124.163169,5900777.679916 514156.626532,5900391.375693 514137.974477,5900005.903392 </gml:coordinates>
        </gml:LineString>
        </ms:msGeometry>
        <ms:oid>85372</ms:oid>
      </ms:PE>
    </gml:featureMember>
    <gml:featureMember>
      <ms:PE>
        <gml:boundedBy>
        <gml:Box srsName="EPSG:26912">
                 <gml:coordinates>514135.399719,5899843.243662 514258.840669,5900005.903392</gml:coordinates>
        </gml:Box>
        </

Notice that it is truncated before the xml is properly closed. As a result firebug reports an XML error, and nothing is displayed.  Anyone know why this is happening?

Thanks,
Rob

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20130502/62a4b718/attachment-0001.html>


More information about the Users mailing list