Unable to parse KML 2.2 LatLonAltBox inside Region element

Description

The xsd KML 2.1 Configuration is able to parse Region elements like the one bellow, but when parsing a 2.2 kml file with the KML 2.2 Configuration, it fails with java.lang.String cannot be cast to org.locationtech.jts.geom.Envelope error.

1 2 3 4 5 6 7 8 9 10 11 <Region> <LatLonAltBox> <north>51.1</north> <south>50</south> <east>4.25</east> <west>1.4</west> </LatLonAltBox> <Lod> <minLodPixels>500</minLodPixels> </Lod> </Region>

Reason being that both v21 and v22 Configurations have bindings for LatLonBoxType but not for LatLonAltBoxType. In v21 a LatLonAltBox element gets parsed to a JTS Envelope because LatLonAltBoxType is a subtype of LatLonBoxType, but in KML 2.2 it's not. Instead, both are derived from AbstractLatLonBoxType, hence LatLonAltBox doesn't get parsed and RegionTypeBinding throws a ClassCastException when casting the contents of its LatLonAltBox element, which wasn't parsed.

Environment

None

Status

Assignee

Gabriel Roldan

Reporter

Gabriel Roldan

Triage

None

Components

Affects versions

21.2

Priority

Medium