Hi Martin,

Just so I understand. You are saying that you have a feature collection 
made up of multi polygons, with some attributes. And those attributes 
may be different from feature to feature? I guess you have a couple of 
options.

The first would be if the set of attributes is well known and a closed 
set, you can just declare a feature type in XML schema with all the 
attributes, marking them as optional. Example:

<xsd:complexType name="myType">
    <xsd:complexContent>
       <xsd:extension base="gml:AbstractFeatureType">
         <xsd:sequence>
           <xsd:element name="geometry" 
type="gml:multiPolygonPropertyType"/>
           <xsd:element name="e1" type=".." minoccurs="0">
           <xsd:element name="e2" type=".." minoccurs="0"/>
           ...
         </xsd:sequence>
       </xsd:extension>
     </xsd:complexContent>
</xsd:complexType>

The second would be to declare a feature with some dynamic content, 
using the xs:any construct. I don't know off hand exactly what this will 
look like.

The third would be to just hope that the parser can parse the attributes 
dynamically. The geotools GML parser will do this in the case where the 
GML document being parsed does not properly specify its schema. I 
believe the OGR gml parser does this as well.

Hope that helps.

-Justin


Martin Tomko wrote:
> Hi Justin, all
> thanks for that, my mistake I did not notice that. I will give it a try, 
> although in the meantime I solved the issue using some local workarounds.
> Now I have a different problem - I am acquiring a FeatureCollection as a 
> result of some processing, where features included have some attributes. 
> I need to output the Features in GML. I was using MultiPolygon for my 
> needs, as ultimately the result IS a MultiPolygon. I however, don't know 
> how best to handle the attributes. My understanding is that I need to 
> declare a new complex XML element that will have GML  geometry and any 
> other attributes. The problem is that there may be different values for 
> the attribute for each of the Polygons contained. Hence, it would 
> probably be better to declare the geometry as a collection of Polygons 
> somehow.
> Does anyone have a GML 3.1.1 example doing something like that? I find 
> it incredibely difficult to find examples for GML3.1.1, and the schemas 
> are much more complex then anything in GML2.
> 
> Thanks
> Martin
> 
> 
> Justin Deoliveira wrote:
>> Nope, it does gml 3 as well, you just have to use a different 
>> configuration.
>>
>> org.geotools.gml2.GMLConfiguration vs
>> org.geotools.gml3.GMLConfiguration
>>
>> -Justin
>>
>> Martin Tomko wrote:
>>> Hi Justin,
>>> thank you for the suggestion. Unfortunately, I think the parser in 
>>> Geotools  (as per 2.5. documentation) is only fit for GML 2.X, is 
>>> that right?
>>> Thanks
>>> Martin
>>>
>>> Justin Deoliveira wrote:
>>>> Hi,
>>>>
>>>> Looks like you are running up against the property reference pattern 
>>>> in GML, it is used quite extensively. I can't really comment on the 
>>>> XMLBeans stuff, our GML parsing uses a different engine. If 
>>>> interested here is the way you could parse a geometry:
>>>>
>>>> import org.geotools.gml3.GMLConfiguration;
>>>> import org.geotools.xml.Parser;
>>>>
>>>> GMLConfiguration gml = new GMLConfiguration();
>>>> Parser p = new Parser(gml);
>>>>
>>>> Polygon p = (Polygon) p.parse( ... );
>>>>
>>>> -Justin
>>>>
>>>> Martin Tomko wrote:
>>>>> Possibly a topic not fitting well to Geotools, but I thought that 
>>>>> people here may know...
>>>>>
>>>>> I need to get from GML geometry to JTS geometry, and I am using 
>>>>> custom XML beans generated from GML and a custom parser. It works 
>>>>> fine most of the time, but today I run into a wall: I have a GML 
>>>>> element in my xsd, importing GML (feature.xsd) in order tohave an 
>>>>> element as follows:
>>>>>
>>>>> <xsd:element name="MyGeometry" type="gml:GeometryPropertyType" 
>>>>> minOccurs="0">
>>>>>
>>>>> When reading this element in XML beans, tI can extract the 
>>>>> GeometryPropertyType gpt, and from it I can do
>>>>> AbstractGeometryType ageom = gpt.getGeometry
>>>>> I have troubles to cast from the AbstractGeometryType to a 
>>>>> PolygonType (I am certain that what comes in is a polygon).
>>>>> I wonder if this is a more common problem with GML 3.1.1 ( I seem 
>>>>> to have found some indications in that respect) or my problem in 
>>>>> the declaration of the geometry.
>>>>>
>>>>> Thanks, and apologies if this is not the appropriate forum.
>>>>> Martin
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>>  
>>>>>
>>>>> Stay on top of everything new and different, both inside and around 
>>>>> Java (TM) technology - register by April 22, and save
>>>>> $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
>>>>> 300 plus technical and hands-on sessions. Register today. Use 
>>>>> priority code J9JMT32. http://p.sf.net/sfu/p
>>>>> _______________________________________________
>>>>> Geotools-gt2-users mailing list
>>>>> [email protected]
>>>>> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>>>>
>>>>
>>>
>>>
>>
>>
> 


-- 
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to