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.

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
Configure