Hi Ben,
many thanks for your help!
1. Yes, we are using the JTS Geometry
and the encoding for e.g.
com.vividsolutions.jts.geom.Polygon polygon = (Polygon)geometry.getValue();
encoder.encode(polygone, new QName("http://www.opengis.net/gml", "Polygon"),
out);
works fine.
2. Please, have a look at our schema Definition for the Geometry:
<xs:element minOccurs="0" name="Geometry"
type="ournamespace:LineString_Curve_MultiCurve_CompositeCurvePropertyType"/>
<xs:complexType name="LineString_Curve_MultiCurve_CompositeCurvePropertyType">
<xs:sequence>
<xs:choice>
<xs:element ref="gml:LineString"/>
<xs:element ref="gml:Curve"/>
<xs:element ref="gml:MultiCurve"/>
<xs:element ref="gml:CompositeCurve"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
Thanks and regards,
Anna Pitaev
_________________________________________
Logica - Releasing your potential
Logica Deutschland GmbH & Co. KG
Rheinstrasse 95
64295 Darmstadt
Germany
Tel.: +49 6151 36860-121
E-Mail: anna.pit...@logica.com
www.logica.com
Logica Deutschland GmbH & Co. KG
Zettachring 4, 70567 Stuttgart; Amtsgericht Stuttgart HRA 722072
Persönlich haftender Gesellschafter: Logica Verwaltungs GmbH
Geschäftsführer: Torsten Straß (Vors.) / Dr. Thomas Elsner / Eric Guyot /
Andreas Manganaro / Olaf Scholz / Oliver Starzonek; Handelsregister AG
Stuttgart HRB 724084
-----Ursprüngliche Nachricht-----
Von: Ben Caradoc-Davies [mailto:ben.caradoc-dav...@csiro.au]
Gesendet: Di 17.11.2009 03:03
An: Pitaev, Anna
Cc: geotools-gt2-users@lists.sourceforge.net
Betreff: Re: [Geotools-gt2-users] GML Encoding problem
On 16/11/09 19:26, Pitaev, Anna wrote:
> we are using our own schema to define the geometry attributes and to encode it
> (using geotools 2.5.8) in this way:
> Configuration configuration = new ApplicationSchemaConfiguration(namespace,
> schema_location.toExternalForm());
> org.geotools.xml.Encoder encoder = new org.geotools.xml.Encoder(
> configuration );
> OutputStream out = new FileOutputStream(new File(path));
> encoder.encode(geometry, new QName( ourNamespace, "Geometry"), out);
> And getting the exception:
> Could not find elmeent declaration for:{ourNamespace}Geometry
Is {ourNamespace}Geometry defined as a top-level element in your schema?
What is the Java type of "geometry"? Is it a JTS geometry (a subclass of
com.vividsolutions.jts.geom.Geometry)? Can you encode it with (for example):
encoder.encode(geometry, GML.Point, out);
I do not think the encoder can encode arbitrary geometries, only a
subset those defined in GML (those implemented in JTS). I am still a
little unclear about what you are trying to do.
Note that your schema needs to conform to the GML encoding rules, and in
particular, you cannot have a geometry as a direct property of a
feature; you must have a property of gml:GeometryPropertyType that
encloses the geometry. I do not know if this is your problem.
> If we encode an instance of the featurecollection
> encoder.encode(featureCollection, new QName( ourNamespace,
> "FeatureCollection"), out);
> we get the warning:
> org.geotools.xml.impl.GetPropertyExecutor visit
> WARNING: org.geotools.feature.defaultfeaturecollect...@13c2ac3
> (org.geotools.feature.DefaultFeatureCollection) is not of type
> [Lorg.opengis.feature.simple.SimpleFeature;
This warning is known to be incorrect. Please ignore it.
http://jira.codehaus.org/browse/GEOT-2621
Kind regards,
--
Ben Caradoc-Davies <ben.caradoc-dav...@csiro.au>
Software Engineer, CSIRO Earth Science and Resource Engineering
Australian Resources Research Centre
26 Dick Perry Ave, Kensington WA 6151, Australia
Please help Logica to respect the environment by not printing this email /
Pour contribuer comme Logica au respect de l'environnement, merci de ne pas
imprimer ce mail / Bitte drucken Sie diese Nachricht nicht aus und helfen Sie
so Logica dabei, die Umwelt zu schützen. / Por favor ajude a Logica a
respeitar o ambiente nao imprimindo este correio electronico.
This e-mail and any attachment is for authorised use by the intended
recipient(s) only. It may contain proprietary material, confidential
information and/or be subject to legal privilege. It should not be copied,
disclosed to, retained or used by, any other party. If you are not an intended
recipient then please promptly delete this e-mail and any attachment and all
copies and inform the sender. Thank you.
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users