Skip to content

Format-Limited KML Case

vectorKMLPolygonEPSG:4326tinybundled

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.

Polygon geometry of format_limited_kml_case, rendered from the case's data
Polygon geometry, rendered from the case's actual geometry. Scale is normalized to the viewport and is not comparable between cases.
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:

pip install "geocase[all]"

View GeoCase on PyPI.

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

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

  1. All attributes become strings. KML <SimpleField> supports type="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).

  2. Coordinates are always WGS 84. KML mandates EPSG:4326. Data in other CRSs must be reprojected before writing to KML.

  3. Z coordinates are included. Even 2D polygons get 0 as a Z value in KML coordinates, producing POLYGON Z geometries on read-back.

  4. 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

  • load
  • attribute-inspection
  • format-comparison

Files

Browse this case on GitHub

Source and license

  • Source: geocase-curated
  • License: MIT

Tags

attributes format_limitation format_specific kml polygon schema type_coercion valid vector