Skip to content

Trouble reading KML file #543

@remi-braun

Description

@remi-braun

Hello,

Some KML files are not correctly read by pyogrio (when fine with fiona even if the handling is more complicated, and the ogr2ogr conversion works also fine).
For other KML files, pyogrio works.

Here is faulty data: ICEYE_X2_QUICKLOOK_SC_124020_20210827T162211.zip

import geopandas as gpd
gpd.read_file('ICEYE_X2_QUICKLOOK_SC_124020_20210827T162211.kml', engine="pyogrio")

Output:

Traceback (most recent call last):
  File "/opt/.pycharm_helpers/pydevd_asyncio/pydevd_asyncio_utils.py", line 11


7, in _exec_async_code
    result = func()
             ^^^^^^
  File "<input>", line 1, in <module>
  File "/root/.local/lib/python3.11/site-packages/geopandas/io/file.py", line 317, in _read_file
    return _read_file_pyogrio(
           ^^^^^^^^^^^^^^^^^^^
  File "/root/.local/lib/python3.11/site-packages/geopandas/io/file.py", line 577, in _read_file_pyogrio
    return pyogrio.read_dataframe(path_or_bytes, bbox=bbox, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/lib/python3.11/site-packages/pyogrio/geopandas.py", line 275, in read_dataframe
    result = read_func(
             ^^^^^^^^^^
  File "/root/.local/lib/python3.11/site-packages/pyogrio/raw.py", line 198, in read
    return ogr_read(
           ^^^^^^^^^
  File "pyogrio/_io.pyx", line 1297, in pyogrio._io.ogr_read
  File "pyogrio/_io.pyx", line 1972, in pyogrio._io.get_default_layer
IndexError: index 0 is out of bounds for axis 0 with size 0

Versions : geopandas: 1.1.0, pyogrio: 0.11.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions