atviriduomenys / spinta

Spinta is a framework to describe, extract and publish data (a DEP Framework).
MIT License
10 stars 4 forks source link

Error on push with geometry type #652

Closed sirex closed 1 week ago

sirex commented 2 weeks ago

When trying to spinta push data with geometry type, following error is raised:

$ spinta --version
0.1.60

$ spinta push sdsa.xlsx -o put-test.data.gov.lt -d datasets/gov/rc/ar/graapskritis 
Traceback (most recent call last): 
  File "cli/push.pyw, line 460, in _push rows
    next(rows) 
  File "spinta/cli/push.py", line 1353, in _save_push_state
    for row in rows: 
  File "spinta/cli/push.py", line 919, in _push_to_remote_spinta
    for row in rows: 
  File "spinta/cli/push.py", line 881, in _prepare_rows_for_push
    for row in rows: 
  File "spinta/cli/push.py", line 1306, in _check_push_state
    for model_type, group in itertools.groupby(rows, key= get_model_type): 
  File "spinta/cli/push.py", line 408, in _read_rows
    yield from _get_model_rows( 
  File "spinta/cli/push.py", line 526, in _get_model_rows
    for row in rows: 
  File "spinta/cli/push.py", line 564, in _iter_model_rows
    for row in rows: 
  File "spinta/cli/push.py", line 739, in _read_rows_by_pages
    row. checksum = _get_data_checksum(row.data) 
  File "spinta/cli/push.py", line 1270, in _get_data_checksum
    data = fix_data_for_json(take(data)) 
  File "spinta/utils/json.py", return (k: fix_data_for_json(v) for
    k, v in data.items()) line 9, in fix_data_for_json 
  File "spinta/utils/json.py", return (k: fix_data_for_json(v) for
    k, v in data.items()) line 9, in <dictcomp> 
  File "spinta/utils/json.py", line 24, in fix_data_for_json 
    raise TypeError(f"{type(data)} probably won't serialize to JSON.")
TypeError: <class 'shapely.geometry.polygon.Polygon'> probably won't serialize to JSON.