[OpenLayers-Users] parse GML v3 with OpenLayers.Format.GML.v3

Tim Schaub tschaub at opengeo.org
Fri Oct 10 20:34:30 EDT 2008


Hey-

Please open a ticket with this detail and assign it to me.

Thanks,
Tim

Alexandre Dube wrote:
> Hi,
> 
>   I'm currently trying the Protocol.WFS new features and I'm facing a 
> similar problem.  I use TinyOWS 0.6.0 and OL 2.7.
> 
>   I've followed the wfs-protocol-transactions example to reproduce the 
> same kind of actions ( add-modify features )  Here's the post request 
> that OL produces for my application :
> 
>  <wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs" service="WFS" 
> version="1.0.0" outputFormat="GML2">
>   <wfs:Insert>
>     <feature:bdga_route_l_arc xmlns:feature="http://127.0.0.1:9999/">
>       <feature:the_geom>
>         <gml:MultiLineString xmlns:gml="http://www.opengis.net/gml" 
> srsName="EPSG:32198">
>           <gml:lineStringMember>
>             <gml:LineString>
>               <gml:coordinates decimal="." cs="," ts=" 
> ">-389909.9750701957,184819.27638712854 
> -390597.89136538754,183513.99931420037</gml:coordinates>
>             </gml:LineString>
>           </gml:lineStringMember>
>         </gml:MultiLineString>
>       </feature:the_geom>
>     </feature:bdga_route_l_arc>
>   </wfs:Insert>
> </wfs:Transaction>
> 
>   This post is very similar the the post produced by the 
> wfs-protocol-transactions example.  But, the example uses Geoserver and 
> no error occurs.  Tinyows gives 2 errors :
> 
> ==> element Transaction: Schemas validity error : Element 
> '{http://www.opengis.net/wfs}Transaction', attribute 'outputFormat': The 
> attribute 'outputFormat' is not allowed.
> 
> ==> element bdga_route_l_arc: Schemas validity error : Element 
> '{http://127.0.0.1:9999/}bdga_route_l_arc': This element is not 
> expected. Expected is one of ( {http://www.opengis.net/gml}_Feature, 
> {http://www.opengis.net/wfs}FeatureCollection ).
> 
>   Both means that the schema WFS-transaction is not respected...  I 
> don't know why it works with GeoServer, but I think it shouldn't.  
> Normand ( one of my co-workers ) modified TinyOWS to make it ignore 
> schema errors, and then it works fine.  But, I think that's not a good 
> solution.  The post request should respect the schema.  It should looks 
> more like Sébastien's first post, with "<gml:FeatureColletion>" and all.
> 
>   So far, I tried GML3 and also tried to edit OL code to change this 
> behavior, but without success.
> 
> Any comments / suggestions / hints would be appreciated, please.
> 
> Alexandre
> 
> Eric Lemoine wrote:
>> Hi Seb. I'd have expected the GML format to automatically pick the
>> appropriate format version for you, but apparently not. Does your GML
>> file advertise the correct version number? Cheers. Eric
>>
>> 2008/10/10, Sébastien Geindre <sebastien.geindre at meteo.fr>:
>>   
>>> It works better with :
>>> <gml:featureMembers .....>
>>>      <wims:tma>
>>>          <wims:geometry>
>>>              <gml:Polygon srsName="EPSG:4326">
>>>                  <gml:exterior>
>>>                      <gml:LinearRing>
>>>                          <gml:posList>49.97 0.67 49.97 3.90 47.66 3.90
>>> 47.66 0.67 49.97 0.67</gml:posList>
>>>                      </gml:LinearRing>
>>>                  </gml:exterior>
>>>              </gml:Polygon>
>>>          </wims:geometry>
>>>      </wims:tma>
>>> </gml:featureMembers>
>>>
>>> and
>>>      var tma = new OpenLayers.Layer.GML("CDG TMA", "tmaCDG.gml",
>>>      {
>>>          format: OpenLayers.Format.GML.v3,
>>>          formatOptions : {
>>>              featureType: "tma",
>>>              featureNS: "http://www.flysafe-eu.org/wims",
>>>              geometryName: "geometry",
>>>              srsName: "urn:x-ogc:def:crs:EPSG:4326",
>>>              schemaLocation: "http://www.flysafe-eu.org/wims memo.xsd"
>>>          }
>>>      });
>>>
>>> Sébastien Geindre a écrit :
>>>     
>>>> hello all,
>>>>
>>>> In OL2.7, I try to parse a simple GML v3 feature, but it does not work.
>>>>
>>>>
>>>> var tma = new OpenLayers.Layer.GML("CDG TMA", "tmaCDG.gml", {format:
>>>> OpenLayers.Format.GML.v3});
>>>>
>>>> the file tmaCDG.gml :
>>>>
>>>> <?xml version="1.0" encoding="URF-8"?>
>>>> <gml:FeatureCollection xmlns:gml="http://www.opengis.net/gml">
>>>> 	<gml:featureMember>
>>>> 		<gml:Polygon srsName="EPSG:4326">
>>>> 			<gml:exterior>
>>>> 				<gml:LinearRing>
>>>> 					<gml:posList>49.97 0.67 49.97 3.90 47.66 3.90 47.66 0.67 49.97
>>>> 0.67</gml:posList>
>>>> 				</gml:LinearRing>
>>>> 			</gml:exterior>
>>>> 		</gml:Polygon>
>>>> 	</gml:featureMember>
>>>> </gml:FeatureCollection>
>>>>
>>>> The file is well-parsed but features in GML.js line 139 is empty...
>>>> this.readNode(elements[i], {features: features});
>>>>
>>>> is there any example of parsing GML v3 ?
>>>>
>>>> thanks
>>>>
>>>>
>>>> _______________________________________________
>>>> Users mailing list
>>>> Users at openlayers.org
>>>> http://openlayers.org/mailman/listinfo/users
>>>>
>>>>       
>>> _______________________________________________
>>> Users mailing list
>>> Users at openlayers.org
>>> http://openlayers.org/mailman/listinfo/users
>>>
>>>     
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>>   
> 
> 


-- 
Tim Schaub
OpenGeo - http://opengeo.org
Expert service straight from the developers.



More information about the Users mailing list