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