[OpenLayers-Users] problem with WFS GetFeature

pablo lopez plablo09 at gmail.com
Wed Nov 25 14:22:01 EST 2009


Thanks Andreas, that pretty much solved the problem, the featureNS bit
doesn't do anything, but the prefix and the geometry name solve the issue.
Regards
Pablo
On Wed, Nov 25, 2009 at 1:06 PM, Andreas Hocevar <ahocevar at opengeo.org>wrote:

> Hi,
>
> Try to do the following:
>
> protocol: OpenLayers.Protocol.WFS.fromWMSLayer(layer, {
>   featureNS: "http://mapserver.gis.umn.edu/mapserver",
>   featurePrefix: "ms",
>   geometryName: "msGeometry"
> });
>
> Note that this looks more like WFS1.0.0 with GML2, so if the above still
> does not work, add
>
>   version: "1.0.0"
>
> Regards,
> Andreas.
>
> pablo lopez wrote:
>
>> Ok, here's the XML response from the server:
>>
>>
>> ?xml version='1.0' encoding="ISO-8859-1" ?>
>> <wfs:FeatureCollection
>>   xmlns:ms="http://mapserver.gis.umn.edu/mapserver"
>>   xmlns:gml="http://www.opengis.net/gml"
>>   xmlns:wfs="http://www.opengis.net/wfs"
>>   xmlns:ogc="http://www.opengis.net/ogc"
>>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>   xsi:schemaLocation="http://mapserver.gis.umn.edu/mapserver
>> http://localhost/cgi-bin/mapserv?map=/var/www/aplicaciones/sined/regsanu.map&amp;SERVICE=WFS&amp;VERSION=1.1.0&amp;REQUEST=DescribeFeatureType&amp;TYPENAME=regs_anu&amp;OUTPUTFORMAT=text/xml<http://localhost/cgi-bin/mapserv?map=/var/www/aplicaciones/sined/regsanu.map&SERVICE=WFS&VERSION=1.1.0&REQUEST=DescribeFeatureType&TYPENAME=regs_anu&OUTPUTFORMAT=text/xml><
>> http://localhost/cgi-bin/mapserv?map=/var/www/aplicaciones/sined/regsanu.map&amp;SERVICE=WFS&amp;VERSION=1.1.0&amp;REQUEST=DescribeFeatureType&amp;TYPENAME=regs_anu&amp;OUTPUTFORMAT=text/xml<http://localhost/cgi-bin/mapserv?map=/var/www/aplicaciones/sined/regsanu.map&SERVICE=WFS&VERSION=1.1.0&REQUEST=DescribeFeatureType&TYPENAME=regs_anu&OUTPUTFORMAT=text/xml>>;
>> subtype=gml/3.1.1  http://www.opengis.net/wfs
>> http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">
>>
>>      <gml:boundedBy>
>>          <gml:Envelope srsName="EPSG:4326">
>>              <gml:lowerCorner>-107.210132 21.041869</gml:lowerCorner>
>>              <gml:upperCorner>-97.144224 29.880024</gml:upperCorner>
>>          </gml:Envelope>
>>      </gml:boundedBy>
>>    <gml:featureMember>
>>      <ms:regs_anu gml:id="regs_anu.1">
>>        <gml:boundedBy>
>>            <gml:Envelope srsName="EPSG:4326">
>>                <gml:lowerCorner>-107.210132 21.041869</gml:lowerCorner>
>>                <gml:upperCorner>-97.144224 29.880024</gml:upperCorner>
>>            </gml:Envelope>
>>        </gml:boundedBy>
>>        <ms:msGeometry>?xml version='1.0' encoding="ISO-8859-1" ?>
>> <wfs:FeatureCollection
>>   xmlns:ms="http://mapserver.gis.umn.edu/mapserver"
>>   xmlns:gml="http://www.opengis.net/gml"
>>   xmlns:wfs="http://www.opengis.net/wfs"
>>   xmlns:ogc="http://www.opengis.net/ogc"
>>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>   xsi:schemaLocation="http://mapserver.gis.umn.edu/mapserver
>> http://localhost/cgi-bin/mapserv?map=/var/www/aplicaciones/sined/regsanu.map&amp;SERVICE=WFS&amp;VERSION=1.1.0&amp;REQUEST=DescribeFeatureType&amp;TYPENAME=regs_anu&amp;OUTPUTFORMAT=text/xml<http://localhost/cgi-bin/mapserv?map=/var/www/aplicaciones/sined/regsanu.map&SERVICE=WFS&VERSION=1.1.0&REQUEST=DescribeFeatureType&TYPENAME=regs_anu&OUTPUTFORMAT=text/xml><
>> http://localhost/cgi-bin/mapserv?map=/var/www/aplicaciones/sined/regsanu.map&amp;SERVICE=WFS&amp;VERSION=1.1.0&amp;REQUEST=DescribeFeatureType&amp;TYPENAME=regs_anu&amp;OUTPUTFORMAT=text/xml<http://localhost/cgi-bin/mapserv?map=/var/www/aplicaciones/sined/regsanu.map&SERVICE=WFS&VERSION=1.1.0&REQUEST=DescribeFeatureType&TYPENAME=regs_anu&OUTPUTFORMAT=text/xml>>;
>> subtype=gml/3.1.1  http://www.opengis.net/wfs
>> http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">
>>
>>      <gml:boundedBy>
>>          <gml:Envelope srsName="EPSG:4326">
>>              <gml:lowerCorner>-107.210132 21.041869</gml:lowerCorner>
>>              <gml:upperCorner>-97.144224 29.880024</gml:upperCorner>
>>          </gml:Envelope>
>>      </gml:boundedBy>
>>    <gml:featureMember>
>>      <ms:regs_anu gml:id="regs_anu.1">
>>        <gml:boundedBy>
>>            <gml:Envelope srsName="EPSG:4326">
>>                <gml:lowerCorner>-107.210132 21.041869</gml:lowerCorner>
>>                <gml:upperCorner>-97.144224 29.880024</gml:upperCorner>
>>            </gml:Envelope>
>>        </gml:boundedBy>
>>        <ms:msGeometry>
>>          <gml:Polygon srsName="EPSG:4326">
>>            <gml:exterior>
>>              <gml:LinearRing>.....some coordinates
>>
>> Thanks in advance
>> Pablo
>>
>> On Wed, Nov 25, 2009 at 12:20 PM, Andreas Hocevar <ahocevar at opengeo.org<mailto:
>> ahocevar at opengeo.org>> wrote:
>>
>>    pablo lopez wrote:
>>
>>        Thanks Andreas, I've just tried your suggestion and it didn't
>>        work. I'm now taking a look at the gml returned by mapserver
>>        to see if I need to specify more parameters.
>>        On the other hand, I was looking at the highlight feature code
>>        in http://trac.openlayers.org/wiki/Highlighting, and I wonder
>>        if there is a way to control the highlighting with mouse
>>        clicks instead of filters.
>>        Any suggestions on this?
>>
>>
>>    This is only recommended if you have very few features. The
>>    prerequisite is to load the layer as vector layer, not from WMS.
>>
>>    But back to the original problem. If you provide a sample XML that
>>    your server returns, it will be easier to see what is wrong.
>>
>>    Regards,
>>    Andreas.
>>
>>
>>        Regards,
>>        Pablo
>>
>>
>>        On Wed, Nov 25, 2009 at 1:31 AM, Andreas Hocevar
>>        <ahocevar at opengeo.org <mailto:ahocevar at opengeo.org>
>>        <mailto:ahocevar at opengeo.org <mailto:ahocevar at opengeo.org>>>
>>
>>        wrote:
>>
>>           Hi,
>>
>>           can you please try the following and report back if it works:
>>
>>
>>           pablo lopez wrote:
>>
>>                          control = new OpenLayers.Control.GetFeature({
>>                              protocol:
>>               OpenLayers.Protocol.WFS.fromWMSLayer(layer),
>>
>>
>>           Instead, use
>>
>>                         protocol:
>>        OpenLayers.Protocol.WFS.fromWMSLayer(layer, {
>>                             featurePrefix: "feature"
>>                         }),
>>
>>           That's the only idea I have.
>>
>>           Regards,
>>           Andreas.
>>
>>           --    Andreas Hocevar
>>           OpenGeo - http://opengeo.org/
>>           Expert service straight from the developers.
>>
>>
>>
>>  ------------------------------------------------------------------------
>>
>>
>>
>>        _______________________________________________
>>        Users mailing list
>>        Users at openlayers.org <mailto:Users at openlayers.org>
>>
>>        http://openlayers.org/mailman/listinfo/users
>>
>>
>>
>>    --    Andreas Hocevar
>>    OpenGeo - http://opengeo.org/
>>    Expert service straight from the developers.
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>>
>>
>
>
> --
> Andreas Hocevar
> OpenGeo - http://opengeo.org/
> Expert service straight from the developers.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20091125/39fb7166/attachment.html


More information about the Users mailing list