[OpenLayers-Users] Problems adding polygon data from GML

Gabriel Nolasco nolasco_gabriel at yahoo.com.br
Tue Nov 3 11:22:54 EST 2009


Hello David!

The problem is that your get feature output format is gml 3.1.1, so you will have to parse the response with OpenLayers.Format.GML.v3.
To instantiate this class correctly you must specify the feature typeName (without prefix) and the feature namespace, something like:

var format = new OpenLayers.Format.GML.v3({
featureType: "RecintosSigpac",
featureNS: "http://mapserver.gis.umn.edu/mapserver"
});

Best regards,
Gabriel Nolasco

> ------------------------------
> 
> Message: 7
> Date: Tue, 3 Nov 2009 15:25:27 +0100
> From: "David Alda Fernandez de Lezea" <dalda at ikt.es>
> Subject: [OpenLayers-Users] Problems adding polygon data
> from GML
> To: <users at openlayers.org>
> Message-ID:
> <224DBDAF88A6AC47BD22432815351BE007877F40 at nekaposta1>
> Content-Type: text/plain; charset="iso-8859-1"
> 
> Hello,
>  
> I'm having some issues trying to add a feature to a vector
> layer from an WFS response. I think that my response it's
> well formed but I'm not sure. This is what I get from my WFS
> 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://192.168.1.65/cgi-bin/mapserv.exe?map=../htdocs/MFD/ejemplo_wfs.map&SERVICE=WFS&VERSION=1.1.0&REQUEST=DescribeFeatureType&TYPENAME=RecintosSigpac&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:23030"> 
>        
> <gml:lowerCorner>526447.763986
> 4758100.330520</gml:lowerCorner> 
>        
> <gml:upperCorner>526591.710676
> 4758280.966702</gml:upperCorner> 
>        </gml:Envelope> 
>       </gml:boundedBy> 
>     <gml:featureMember> 
>       <ms:RecintosSigpac
> gml:id="RecintosSigpac.193303"> 
>         <gml:boundedBy> 
>          <gml:Envelope
> srsName="EPSG:23030"> 
>          
> <gml:lowerCorner>526447.763986
> 4758100.330520</gml:lowerCorner> 
>          
> <gml:upperCorner>526591.710676
> 4758280.966702</gml:upperCorner> 
>      
>    </gml:Envelope> 
>         </gml:boundedBy> 
>         <ms:msGeometry> 
>           <gml:Polygon
> srsName="EPSG:23030"> 
>            
> <gml:exterior> 
>              
> <gml:LinearRing> 
>                
> <gml:posList srsDimension="2">526484.432428
> 4758280.966702 526480.100971 4758268.076507 526475.463251
> 4758253.072136 526468.535947 4758229.169445 526447.763986
> 4758186.689696 526453.315125 4758154.550751 526455.754887
> 4758140.485935 526495.766666 4758112.547879 526500.834389
> 4758115.350669 526504.219488 4758116.685545 526506.649401
> 4758117.569927 526507.626820 4758117.573707 526510.130663
> 4758117.015581 526514.410883 4758114.891216 526521.314254
> 4758109.640088 526528.210404 4758104.491330 526533.302118
> 4758101.094873 526535.430830 4758100.330520 526540.534776
> 4758102.602904 526577.633954 4758119.082826 526591.710676
> 4758125.346099 526585.498394 4758151.543640 526579.035838
> 4758178.838603 526575.798470 4758190.535962 526564.481114
> 4758273.001370 526551.499563 4758266.407290 526537.298512
> 4758271.136785 526530.463481 4758272.897528 526516.551118
> 4758275.450028 526496.415011 4758279.002411 526484.432428
> 4758280.966702 </gml:posList> 
>              
> </gml:LinearRing> 
>            
> </gml:exterior> 
>           </gml:Polygon> 
>         </ms:msGeometry> 
>       </ms:RecintosSigpac> 
>     </gml:featureMember> 
> </wfs:FeatureCollection> 
>  
> And I'm adding the feature by this way:
>  
> var features = new
> OpenLayers.Format.GML().read(response.responseText);
> hilites.destroyFeatures();
> hilites.addFeatures(features);
> hilites.setVisibility(true);
>  
> where hilites is a Vector Layer.
>  
> I'll show you too my GetFeature url:
>  
> http://192.168.1.65/cgi-bin/mapserv.exe?map=../htdocs/MFD/ejemplo_wfs.map&SERVICE=WFS&VERSION=1.1.0&REQUEST=GetFeature&TYPENAME=RecintosSigpac&FILTER=%3CFilter%3E%3CPropertyIsEqualTo%3E%3CPropertyName%3EGID%3C/PropertyName%3E%3CLiteral%3E193303%3C/Literal%3E%3C/PropertyIsEqualTo%3E%3C/Filter%3E
>  
> Can someone help me, please?
>  
> Thanks.
> 
>  
> 
> Un saludo,
> 
>  
> 
> ??????????????????????????????????????????????????????????????????????????????????
> 
> 
> David Alda Fern?ndez de Lezea
> 
> Lurralde eta Biodibertsitate Saila / Dpto. de Territorio y
> Biodiversidad
> 
>  
> 
> IKT
> 
> Granja Modelo s/n ? 01192 ? Arkaute (Araba)
> 
> 
> ??????????????????????????????????????????????????????????????????????????????????
> Tlfnos.: 945-00-32-95         
>            
>    Fax: 945-00.32.90
> ??????????????????????????????????????????????????????????????????????????????????
> email: dalda at ikt.es 
>                
>               web:
> www.ikt.es <http://www.ikt.es/> 
> ??????????????????????????????????????????????????????????????????????????????????


      ____________________________________________________________________________________
Veja quais são os assuntos do momento no Yahoo! +Buscados
http://br.maisbuscados.yahoo.com



More information about the Users mailing list