Format-Limited KML Case¶
A KML file demonstrating inherent format limitations: all extended-data attributes are stored as strings regardless of their original type, coordinates are always WGS 84, and Z coordinates are included even when not meaningful. Exposes loaders or converters that assume numeric attribute types survive a KML round-trip.
| Property | Value |
|---|---|
| Case ID | format_limited_kml_case |
| Category | vector |
| Format | KML |
| Geometry type | Polygon |
| CRS | EPSG:4326 |
| Location | Copenhagen, Denmark (synthetic) — 10.00°E, 52.00°N → 12.30°E, 54.30°N |
| Test tier | unit |
| Size class | tiny |
| Storage class | bundled |
| Redistributable | yes |
| Loader | geopandas |
| Status | validated |
Use this case¶
import pytest
@pytest.mark.geocase_case("format_limited_kml_case")
def test_format_limited_kml_case(geocase_case) -> None:
data = geocase_case.load()
assert data is not None
Use GeoCase in your tests¶
Install the complete set of vector, raster, and NetCDF dependencies:
What this case checks¶
Detect loaders or cross-format converters that assume attribute types (integer, float, boolean) survive a KML round-trip. In KML all ExtendedData SimpleField values are strings, so population "15000" is a string, not an int. Naive downstream code that does arithmetic on these columns without casting will fail silently.
Risk types covered¶
attribute/lossattribute/schema_mismatchattribute/type_coercionformat/limitation
Expected behavior¶
| Assertion | Expected |
|---|---|
expect_loadable |
yes |
expect_valid_geometry |
yes |
expect_crs |
yes |
expected_epsg |
4326 |
expected_geometry_types |
Polygon |
Notes¶
Purpose¶
This case demonstrates inherent limitations of the KML format when used to store vector data with typed attributes.
KML format limitations exercised¶
-
All attributes become strings. KML
<SimpleField>supportstype="string",type="int",type="float", etc., but in practice most KML producers and the OGR/GDAL KML driver store everything as strings. After a round-trip through KML,population=15000(int) becomes"15000"(string). -
Coordinates are always WGS 84. KML mandates EPSG:4326. Data in other CRSs must be reprojected before writing to KML.
-
Z coordinates are included. Even 2D polygons get
0as a Z value in KML coordinates, producingPOLYGON Zgeometries on read-back. -
No native null support. Missing attribute values can only be represented as empty strings or by omitting the
<SimpleData>tag entirely, which loaders may interpret differently.
Schema details¶
| Attribute | Original type | KML round-trip type | Notes |
|---|---|---|---|
population |
int |
string |
"15000" not 15000 |
area_km2 |
float |
string |
"89.123456789" as text |
is_urban |
bool |
string |
"true"/"false" as text |
category |
string |
string |
Unchanged — already a string |
What this case catches¶
- Code that does arithmetic on KML attributes without explicit type
casting (e.g.
gdf["population"].sum()returns string concatenation). - Cross-format converters that silently assume attribute types are preserved through KML.
- Loaders that treat KML
type="int"schema hints as authoritative when the actual values are strings.
Geometry¶
Three simple WGS 84 polygons (rectangular zones) across northern Europe.
Required capabilities¶
loadattribute-inspectionformat-comparison
Files¶
Source and license¶
- Source: geocase-curated
- License: MIT
Tags¶
attributes format_limitation format_specific kml polygon schema type_coercion valid vector
Related cases¶
- Shapefile Field Name Truncation --
shapefile_field_truncation - Parquet Mixed Schema Attributes --
parquet_mixed_schema_attributes - Format-limited Precision Polygon --
format_limited_precision_polygon - Shapefile Legacy DBF Encoding --
shapefile_encoding_legacy - Shapefile Ring Orientation Reversal --
shapefile_ring_orientation