I have a GML geometry that I would like to convert to WKT (in order to insert it in the geometry with Z column of a PostGIS DB). Here is a geometry sample (from CityGML):
<gml:MultiSurface srsName="EPSG:4979" srsDimension="3"> <gml:surfaceMember srsDimension="3"> <gml:Polygon srsDimension="3"> <gml:exterior> <gml:LinearRing srsDimension="3"> <gml:posList srsDimension="3">41.8636830995329 12.4911723999943 0 41.8637580995329 12.4912074999943 0 41.8637078995329 12.4914008999944 0 41.8636328995329 12.4913657999944 0 41.8636830995329 12.4911723999943 0</gml:posList> </gml:LinearRing> </gml:exterior> </gml:Polygon> </gml:surfaceMember> <gml:surfaceMember srsDimension="3"> <gml:Polygon srsDimension="3"> <gml:exterior> <gml:LinearRing srsDimension="3"> <gml:posList srsDimension="3">41.8637580995329 12.4912074999943 0 41.8636830995329 12.4911723999943 0 41.8636830995329 12.4911723999943 13 41.8637580995329 12.4912074999943 13 41.8637580995329 12.4912074999943 0</gml:posList> </gml:LinearRing> </gml:exterior> </gml:Polygon> </gml:surfaceMember> <gml:surfaceMember srsDimension="3"> <gml:Polygon srsDimension="3"> <gml:exterior> <gml:LinearRing srsDimension="3"> <gml:posList srsDimension="3">41.8637078995329 12.4914008999944 0 41.8637580995329 12.4912074999943 0 41.8637580995329 12.4912074999943 13 41.8637078995329 12.4914008999944 13 41.8637078995329 12.4914008999944 0</gml:posList> </gml:LinearRing> </gml:exterior> </gml:Polygon> </gml:surfaceMember> P...] </gml:MultiSurface>
So, the <gml:MultiSurface> contains several <gml:surfaceMember>, each of them being a <gml:Polygon>. I would like to convert this geometry to a WKT Multipolygon representation. If I use a GeometryExtractor, my input GML geometry is output like this and cannot be inserted into the PostGIS table:
MULTIPOLYGON ((12.4889684999943 41.8608646995328 0,12.4892365999943 41.8608671995328 0),(12.4892365999943 41.8608671995328 0,12.4892352999943 41.8608493995329 0),(12.4892352999943 41.8608493995329 0,12.4893177999943 41.8608503995328 0),(12.4893177999943 41.8608503995328 0,12.4893234999943 41.8606906995328 0),(12.4893234999943 41.8606906995328 0,12.4889687999943 41.8606866995328 0),(12.4889687999943 41.8606866995328 0,12.4889684999943 41.8608646995328 0)),MULTIPOLYGON ((12.4892365999943 41.8608671995328 0,12.4889684999943 41.8608646995328 0),(12.4889684999943 41.8608646995328 0,12.4889684999943 41.8608646995328 9),(12.4889684999943 41.8608646995328 9,12.4892365999943 41.8608671995328 9),(12.4892365999943 41.8608671995328 9,12.4892365999943 41.8608671995328 0)),MULTIPOLYGON ((12.4892352999943 41.8608493995329 0,12.4892365999943 41.8608671995328 0),(12.4892365999943 41.8608671995328 0,12.4892365999943 41.8608671995328 9),(12.4892365999943 41.8608671995328 9,12.4892352999943 41.8608493995329 9),(12.4892352999943 41.8608493995329 9,12.4892352999943 41.8608493995329 0)),MULTIPOLYGON ((12.4893177999943 41.8608503995328 0,12.4892352999943 41.8608493995329 0),(12.4892352999943 41.8608493995329 0,12.4892352999943 41.8608493995329 9),(12.4892352999943 41.8608493995329 9,12.4893177999943 41.8608503995328 9),(12.4893177999943 41.8608503995328 9,12.4893177999943 41.8608503995328 0)),MULTIPOLYGON ((12.4893234999943 41.8606906995328 0,12.4893177999943 41.8608503995328 0),(12.4893177999943 41.8608503995328 0,12.4893177999943 41.8608503995328 9),(12.4893177999943 41.8608503995328 9,12.4893234999943 41.8606906995328 9),(12.4893234999943 41.8606906995328 9,12.4893234999943 41.8606906995328 0)),MULTIPOLYGON ((12.4889687999943 41.8606866995328 0,12.4893234999943 41.8606906995328 0),(12.4893234999943 41.8606906995328 0,12.4893234999943 41.8606906995328 9),(12.4893234999943 41.8606906995328 9,12.4889687999943 41.8606866995328 9),(12.4889687999943 41.8606866995328 9,12.4889687999943 41.8606866995328 0)),MULTIPOLYGON ((12.4889684999943 41.8608646995328 0,12.4889687999943 41.8606866995328 0),(12.4889687999943 41.8606866995328 0,12.4889687999943 41.8606866995328 9),(12.4889687999943 41.8606866995328 9,12.4889684999943 41.8608646995328 9),(12.4889684999943 41.8608646995328 9,12.4889684999943 41.8608646995328 0)),MULTIPOLYGON ((12.4889684999943 41.8608646995328 9,12.4889687999943 41.8606866995328 9),(12.4889687999943 41.8606866995328 9,12.4893234999943 41.8606906995328 9),(12.4893234999943 41.8606906995328 9,12.4893177999943 41.8608503995328 9),(12.4893177999943 41.8608503995328 9,12.4892352999943 41.8608493995329 9),(12.4892352999943 41.8608493995329 9,12.4892365999943 41.8608671995328 9),(12.4892365999943 41.8608671995328 9,12.4889684999943 41.8608646995328 9))
Any idea what I am doing wrong?
Best regards