Hello,

I have a SimpleFeatureCollection whose SimpleFeatures have been created from
a custom GeoJSON decoder. Then I try to encode the collection into GML using
the following code:

GML encoder = new GML(GML.Version.WFS1_1);
encoder.encode(outputStream, featureCollection);

First, I found that if I do not set the namespace URI on the
SimpleFeatureTypeBuilder in my GeoJSON decoder to http://www.opengis.net/wfs,
the namespace on the properties in the encoded GML is null, e.g. (see last 2
line lines):

<?xml version="1.0" encoding="UTF-8"?>
<wfs:FeatureCollection
    xmlns:ogc="http://www.opengis.net/ogc";
    xmlns:gml="http://www.opengis.net/gml";
    xmlns:xlink="http://www.w3.org/1999/xlink";
    xmlns:ows="http://www.opengis.net/ows";
    xmlns:wfs="http://www.opengis.net/wfs";>
    <gml:boundedBy>
        <gml:Envelope>
            <gml:lowerCorner>-124.1633 -34.3667</gml:lowerCorner>
            <gml:upperCorner>57.7144 47.7528</gml:upperCorner>
        </gml:Envelope>
    </gml:boundedBy>
    <gml:featureMember>
        <wfs:MultiPoint gml:id="9c068ab0-b56c-40bb-8e33-b4507ed3547c">
            <gml:name>Cape Town</gml:name>
            <gml:boundedBy>
                <gml:Envelope>
                    <gml:lowerCorner>18.4167 -33.9167</gml:lowerCorner>
                    <gml:upperCorner>18.4167 -33.9167</gml:upperCorner>
                </gml:Envelope>
            </gml:boundedBy>
            *<null:fillColor>#ee9900</null:fillColor>
            <null:strokeColor>#000000<null:strokeColor>
*etc.

So I changed my GeoJSON decoder to set the namespace URI on the builder to
the URI above. Now the properties are encoding with wfs:fillColor,
wfs:strokeColor, etc.

Second, I noticed that each gml:featureMember element has a
gml:boundedByelement even though there is only a single point
geometry. Is this because
the geometry is actually a MultiPoint?

Third, during encoding I get these warning messages on the log. It may be
affecting performance when I'm encoding a huge number of features, and also
I think it should read "Could not find type..." Is there something I can do
in building the features to avoid these warning messages?

May 19, 2011 10:23:45 AM org.geotools.gml2.bindings.GMLEncodingUtils
AbstractFeatureType_getProperties
WARNING: Could find type for Polygon in the schema, generating type from
feature.
May 19, 2011 10:23:45 AM org.geotools.gml2.bindings.GMLEncodingUtils
AbstractFeatureType_getProperties
WARNING: Could find type for MultiPoint in the schema, generating type from
feature.

Thanks.

-- 
Rico
------------------------------------------------------------------------------
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its 
next-generation tools to help Windows* and Linux* C/C++ and Fortran 
developers boost performance applications - including clusters. 
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to