Hello,

Recently I migrated to Geotools 24 from version 12.3

I am facing an issue in GML encoder with the following code.


        SimpleFeatureType featureType = DataUtilities.createType("TYPE",
"the_geom:Polygon,name:\"\",tag:\"\"");
        SimpleFeatureBuilder featureBuilder = new
SimpleFeatureBuilder(featureType);
        WKTReader reader = new WKTReader(geometryFactory);
        ListFeatureCollection collection = new
ListFeatureCollection(featureType);
       ...........
       ............
        ByteArrayOutputStream xml = new ByteArrayOutputStream();

        GML encode2 = new GML(GML.Version.WFS1_0);
        encode2.setBaseURL(new URL("http://localhost/gml";));
        encode2.setNamespace("location", "plot.xsd");
        encode2.encode(xml, collection);

The generated GML has a tag like this.

*<null:TYPE gml:id="fid-236fab5a_1753cf2b2e0_5f2f">*

Please help me to solve this.

Thank you.

Complete GML:
-----------------------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?><wfs:FeatureCollection
xmlns:location="plot.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema";
xmlns:wfs="http://www.opengis.net/wfs"; xmlns:gml="http://www.opengis.net/gml";
xmlns:ogc="http://www.opengis.net/ogc"; xmlns:ows="http://www.opengis.net/ows";
xmlns:xlink="http://www.w3.org/1999/xlink";>
<gml:boundedBy>
<gml:Envelope>
<gml:lowerCorner>7054335.34497 3921155.008157</gml:lowerCorner>
<gml:upperCorner>7054359.07687 3921196.584457</gml:upperCorner>
</gml:Envelope>
</gml:boundedBy>
<gml:featureMembers>
*<null:TYPE gml:id="fid-236fab5a_1753cf2b2e0_5f2f">*
<gml:name>8</gml:name>
<gml:boundedBy>
<gml:Envelope>
<gml:lowerCorner>7054335.34497 3921155.008157</gml:lowerCorner>
<gml:upperCorner>7054359.07687 3921196.584457</gml:upperCorner>
</gml:Envelope>
</gml:boundedBy>
<the_geom>
<gml:Polygon srsDimension="2">
<gml:exterior>
<gml:LinearRing>
<gml:posList>7054354.93557 3921155.008157 7054349.62887 3921157.229857
7054338.15677 3921158.997157 7054338.49397 3921160.634957 7054336.59067
3921178.478357 7054335.34497 3921194.804957 7054343.36007 3921196.584457
7054351.40017 3921183.884957 7054358.23857 3921175.185057 7054359.07687
3921171.582057 7054354.93557 3921155.008157</gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</the_geom>
<tag>Y</tag>
</null:TYPE>
</gml:featureMembers>
</wfs:FeatureCollection>

---------------------------------

Thank You,

Sunish.
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to