[OpenLayers-Users] Working with Openlayers.Layer.Vector and WFS

Eduardo Ramos eduardo.j.ramos at novabase.pt
Fri Jul 16 10:25:07 EDT 2010


Well, thanks for the quick response.

The WFS response to
'http://localhost:2006/GetFeature.ashx?service=WFS&version=1.0.0&request=GetCapabilities'
is:

<WFS_Capabilities xsi:schemaLocation="http://www.opengis.net/wfs
http://localhost:2006/GetFeature.ashx?service=MXP-WFS&request=GetSchema&schema=urn%3aopengis%3awfs%3a1.0.0%3aWFS-capabilities" 
                  version="1.0.0" 
                  updateSequence="0">
  <Service>
    <Name>Sample WFS Server</Name>
    <Title>Sample WFS Server</Title>
    <OnlineResource>http://localhost:2006/GetFeature.ashx</OnlineResource>
  </Service>
  <Capability>
    <Request>
      <GetCapabilities>
        <DCPType>
          <HTTP>
            <Get onlineResource="http://localhost:2006/GetFeature.ashx"/>
            <Post onlineResource="http://localhost:2006/GetFeature.ashx"/>
          </HTTP>
        </DCPType>
      </GetCapabilities>
      <DescribeFeatureType>
        <SchemaDescriptionLanguage>
          <XMLSCHEMA/>
        </SchemaDescriptionLanguage>
        <DCPType>
          <HTTP>
            <Get onlineResource="http://localhost:2006/GetFeature.ashx"/>
            <Post onlineResource="http://localhost:2006/GetFeature.ashx"/>
          </HTTP>
        </DCPType>
      </DescribeFeatureType>
      <GetFeature>
        <ResultFormat>
          <GML2/>
          <GML3/>
        </ResultFormat>
        <DCPType>
          <HTTP>
            <Get onlineResource="http://localhost:2006/GetFeature.ashx"/>
            <Post onlineResource="http://localhost:2006/GetFeature.ashx"/>
          </HTTP>
        </DCPType>
      </GetFeature>
    </Request>
  </Capability>
  <FeatureTypeList>
    <Operations>
      <Query/>
    </Operations>
    <FeatureType>
      <Name>miwfs:MonkeyIsland</Name>
      <Title>MonkeyIsland</Title>
      <Abstract>Abstract for MonkeyIsland</Abstract>
      <Keywords>Keywords for MonkeyIsland</Keywords>
      <SRS>epsg:4326</SRS>
      <LatLongBoundingBox minx="-9.517034" miny="36.961718" maxx="-6.189968"
maxy="42.15434"/>
    </FeatureType>
  </FeatureTypeList>
  <ogc:Filter_Capabilities>
    <ogc:Spatial_Capabilities>
      <ogc:Spatial_Operators>
        <ogc:BBOX/>
        <ogc:Equals/>
        <ogc:Disjoint/>
        <ogc:Intersect/>
        <ogc:Within/>
        <ogc:Contains/>
      </ogc:Spatial_Operators>
    </ogc:Spatial_Capabilities>
    <ogc:Scalar_Capabilities>
      <ogc:Logical_Operators/>
      <ogc:Comparison_Operators>
        <ogc:Simple_Comparisons/>
        <ogc:NullCheck/>
      </ogc:Comparison_Operators>
      <ogc:Arithmetic_Operators>
        <ogc:Simple_Arithmetic/>
      </ogc:Arithmetic_Operators>
    </ogc:Scalar_Capabilities>
  </ogc:Filter_Capabilities>
</WFS_Capabilities>

I've made some changes in the request, namely the version and featureNS, and
now it looks like this:

var layer = new OpenLayers.Layer.Vector("Guybrush Threepwood", {
                 strategies: [new OpenLayers.Strategy.BBOX()],
                 protocol: new OpenLayers.Protocol.WFS({
                     version: "1.0.0",
                     url: "http://localhost:2006/GetFeature.ashx",
                     featureType: "MonkeyIsland",
                     featureNS: "http://www.opengis.net/wfs/",
                     geometryName: "VL_GMTR",
                     srsName: "EPSG:4326"
                 }),
                 projection: new OpenLayers.Projection("EPSG:4326")
             });

             map.addLayer(layer);


By the way, my WFS server has the following Features:

http://localhost:2006/GetFeature.ashx?service=WFS&version=1.0.0&request=DescribeFeatureType

<schema targetNamespace="http://www.mapinfo.com/wfs"
elementFormDefault="qualified">
  <xs:import namespace="http://www.opengis.net/wfs"
schemaLocation="http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd"/>
  <xs:element name="MonkeyIsland" type="miwfs:MonkeyIsland_Type"
substitutionGroup="gml:_Feature"/>
  <xs:complexType name="MonkeyIsland_Type">
    <xs:complexContent>
      <xs:extension base="gml:AbstractFeatureType">
        <xs:sequence>
          <xs:element name="ID_ISLAND" nillable="true" type="xs:string"
minOccurs="0" maxOccurs="1"/>
          <xs:element name="VL_GMTR" minOccurs="0" maxOccurs="1">
            <xs:complexType>
              <xs:sequence>
                <xs:element ref="gml:_Geometry"/>
              </xs:sequence>
            </xs:complexType>
          </xs:element>
          <xs:element name="ROWID" nillable="true" type="xs:string"
minOccurs="0" maxOccurs="1"/>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</schema>

Thank you

Edu

-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Working-with-Openlayers-Layer-Vector-and-WFS-tp5301971p5302153.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list