[OpenLayers-Users] Problems adding polygon data from GML

David Alda Fernandez de Lezea dalda at ikt.es
Wed Nov 4 02:24:05 EST 2009


 
Hello,

Thank you very much, that piece of code helped me a lot. But I've got a question for you. This 'fucntionallity' worked very well 2 weeks ago, but this week I reviewed it and I realized that it didn't work properly, suddenly the geometries were not selected, and 2 weeks ago they were selected.So I might have made some changes in my WFS server configuration because it worked and now I've had to add this piece of code. My WFS server is defined like this:

MAP
		NAME "wfs_server"
		STATUS ON
		EXTENT 460000 4710000 610000 4820000 # Euskadi
	
		PROJECTION
			"init=epsg:23030"
		END
		
		SHAPEPATH "shapes/"
		FONTSET "misc/fonts/fonts.txt"
		SYMBOLSET "misc/symbols/symbols.sym"
	
		IMAGETYPE "image/png; mode=24bit"
		IMAGECOLOR 255 255 255
		UNITS METERS
		
		DEBUG ON
		CONFIG "MS_ERRORFILE" "C:/ms4w/Apache/htdocs/MFD/tmp/ms_wfs.log"
		
		WEB
			IMAGEPATH "MFD/tmp/"
			IMAGEURL "tmp/"
			METADATA
				"wfs_title" "IKT WFS Server" ## REQUIRED
				"wfs_abstract" "Servicio de mapas WFS de IKT Nekazal Teknologia. Powered by Apache and UMN MapServer" ## REQUIRED
				"wfs_onlineresource" "http://192.168.1.65/cgi-bin/mapserv.exe?map=../htdocs/MFD/ejemplo_wfs.map&" ## Recommended
				"wfs_srs" "EPSG:23030" ## Recommended
				"wfs_keywordlist"		"IKT,Euskadi,Mapas Euskadi"
				"wfs_fees"		"none"
				"wfs_accessconstraints"		"Ninguna"
				"ows_contactorganization"   "http://www.ikt.es"
				"wfs_geometry_element_name" "MS_GEOMETRY"
			END
		END
	
		LAYER
			NAME "RecintosSigpac"
			PROJECTION
				"init=epsg:23030"
			END
			METADATA
				"wfs_title" "Recintos Sigpac 2009" ## REQUIRED
				"wfs_abstract" "Recintos"
				"wfs_name" "Recintos"
				"wfs_geometry_element_name" "MS_GEOMETRY"
				"wfs_request_method"        "GET"
				"wfs_srs" "EPSG:23030" ## Recommended
				"wfs_extent"          "460000 4710000 610000 4820000"
				"gml_featureid" "gid" ## REQUIRED
				"gml_exclude_items"         "all"
			END
			TYPE POLYGON
			
			CONNECTIONTYPE oraclespatial
			CONNECTION "admcarto/admcarto at ORA10GDE"
			
			DATA "GEOMETRY FROM (SELECT * FROM GT_SIGPAC_RECINTOS) USING UNIQUE gid SRID 82337" #todo el sigpac
			
			DUMP TRUE ## REQUIRED
			
			CLASS
				NAME "Municipios_Gipuzkoa"
				STYLE
					OUTLINECOLOR 255 255 255
				END
				TEMPLATE "ttt_query.html"
			END
			
			
			STATUS ON
		END # Layer
		
		LAYER
			NAME "municipios"
			PROJECTION
				"init=epsg:23030"
			END
			METADATA
				"wfs_title" "Municipios 96" ## REQUIRED
				"wfs_abstract" "municipios"
				"wfs_name" "municipios"
				"wfs_geometry_element_name" "MS_GEOMETRY"
				"wfs_srs" "EPSG:23030" ## Recommended
				"wfs_extent"          "460000 4710000 610000 4820000"
				"gml_featureid" "gid" ## REQUIRED
				"gml_exclude_items"         "all"
				
			END
			TYPE POLYGON
			
			CONNECTIONTYPE oraclespatial
			CONNECTION "admcarto/admcarto at ORA10GDE"
			
			DATA "GEOMETRY FROM (SELECT * FROM GT_MUNICIPIOS_96) USING UNIQUE gid SRID 82337" #todo el sigpac
			
			DUMP TRUE ## REQUIRED
			
			CLASS
				NAME "Municipios_Gipuzkoa"
				STYLE
					OUTLINECOLOR 255 255 255
				END
				TEMPLATE "ttt_query.html"
			END
			
			
			STATUS ON
		END # Layer
	
	
END # Map File


Is there anything here that makes you know that the response of the WFS Service is in GML v3?

How can you specify it in the map file?

The getFeature request I use is this:

http://192.168.1.65/cgi-bin/mapserv.exe?map=../htdocs/MFD/ejemplo_wfs.map&SERVICE=WFS&VERSION=1.1.0&REQUEST=GetFeature&MAXFEATURES=1000&EXCEPTIONS=application/vnd.ogc.se_xml&TYPENAME=RecintosSigpac&FILTER=<Filter><PropertyIsEqualTo><PropertyName>GID</PropertyName><Literal>125</Literal></PropertyIsEqualTo></Filter>

Thanks again.

 
 
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
··················································································

-----Mensaje original-----
De: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] En nombre de Gabriel Nolasco
Enviado el: martes, 03 de noviembre de 2009 17:23
Para: users at openlayers.org
Asunto: Re: [OpenLayers-Users] Problems adding polygon data from GML

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=Rec
> intosSigpac&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=RecintosSigp
> ac&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
_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users



More information about the Users mailing list