I followed this example to refer to the schema I just generated:
GML encode2 = new GML(Version.GML2);
encode2.setBaseURL(baseURL);
encode2.setNamespace("location", "location.xsd");
encode2.encode(out2, collection);
Rico
On 5/19/2011 9:36 PM, Jody Garnett wrote:
Somehow we have to configure the encoder to refer
to your schema; perhaps the rest of the examples on that
page will help?
--
Jody Garnett
On Friday, 20 May 2011
at 12:25 PM, Rico Lelina wrote:
I tried generating the schema based on the code
samples and I get the same results as not generating
the schema. Maybe I'm doing something wrong. I'll have
time next week to look into it again.
Thanks,
Rico
On 5/19/2011 7:20 PM, Jody Garnett wrote:
Perhaps my email was too polite :-)
Rico you need to generate an XML
schema; or it is not expected to work at
all. Indeed the fact you are getting
anything is a statement to how stable/robust
the code is :-)
Please have a look over the docs; and
if you have any questions let me know on the
email list and we can update the docs.
--
Jody Garnett
On
Friday, 20 May 2011 at 3:14 AM, Jody Garnett
wrote:
Hurray feedback :-)
I put together the
GML utility class to try and
package up some of the GTXML /
Configuration options; but as
I am learning the ropes I
really need feedback for it to
work correctly.
One thing that is
missing from your example
below is a reference to your
XML Schema? Without that I
cannot expect things to work
very smoothly? You can use the
utility class to generate your
xml schema if you have not
already.
Note that "boundedby"
is part of the
AbstractFeatureType; the code
must of defaulted to use
AbstractFeatureType as you
have not provided a real XML
Schema for it to follow?
There is a picture of
how things work on the
documentation page; but as
indicated I need assistance
with the code examples.
Can you try again with
your own XSD file and tell me
if things improve?
--
Jody Garnett
On Friday, 20 May 2011
at 1:55 AM, Rico Lelina wrote:
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:boundedBy
element 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
|
------------------------------------------------------------------------------
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