Hi,
After debugging this, I think this is a bug in geotools. I have made a
unittest based on the snippet below, and made a commit in my clone. Can
somebody review if this is really a bug, if so, I will make an issue in
Jira, and create a pull request.
The commit fixing this issue for me:
https://github.com/mtoonen/geotools/commit/d17e61bf48f9445eae76fe5f115a8d2568dbe0f1
Basically, when there are multiple Surface elements, it parses the
first/deepest Surface element (which returns a correct MultiPolygon),
and then moves on to the outer Surface, where it tries to get underlying
polygons, which fails (there are no polygons, only the previously parsed
MultiPolygon). Creating a new multipolygon with a null arguments
(https://github.com/geotools/geotools/blob/master/modules/extension/xsd/xsd-gml3/src/main/java/org/geotools/gml3/bindings/ext/SurfaceTypeBinding.java#L71)
creates an empty MultiPolygon.
So my solution was to check if there was already a parsed MultiPolygon
and - if so - return that one. Otherwise parse the patches as before.
Thanks!
Regards,
Meine Toonen
B3Partners BV
Tel: 030 214 2083
On 12-04-16 10:18, Meine Toonen wrote:
Hi list,
When parsing a gml file, I came upon a problem. When the geometry part
of the gml file has a surfaceMember, the GML parser returns an empty
MultiPolygon. When removing the surfaceMember (and preceding Surface)
element, it returns a correct MultiPolygon.
I've created a simplified version of the gml snippet:
<?xml version="1.0"?>_*
*__*<gml:Surface>*__*
*__* <gml:surfaceMember>*_
<gml:Surface gml:id="ID2">
<gml:patches>
<gml:PolygonPatch>
<gml:exterior>
<gml:LinearRing>
<gml:posList>0 0 0 1 1 1 1 0 0 0</gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:PolygonPatch>
</gml:patches>_*
*__* </gml:Surface>*__*
*__* </gml:surfaceMember>*_
</gml:Surface>
I've marked the offending elements. When removing the underlined+bold
elements, parsing works. I've created a gist:
https://gist.github.com/mtoonen/dc33661215bffcfb37820afe6fe97a20
The GML is valid and well-formed.
Any thoughts?
Regards,
--
Meine Toonen
B3Partners BV
Tel: 030 214 2083
------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users