MerginMaps / work-packages

Mergin Maps Work Packages: manage field surveys for multiple teams
MIT License
7 stars 4 forks source link

Filtering by geometry requires column named "geometry" #52

Open wonder-sk opened 1 year ago

wonder-sk commented 1 year ago

When filtering by geometry, currently the tool is always expecting that the geometry column is named geometry - but this does not need to be the case - other names can be used - e.g. geom.

The problem is here: https://github.com/MerginMaps/mergin-work-packages/blob/main/workpackages/wp.py#L303

Python error:

Traceback (most recent call last):
  File "mergin_work_packages.py", line 5, in <module>
    run_wp_mergin_with_context(parse_args())
  File "/mergin-work-packages/workpackages/wp_mergin.py", line 309, in run_wp_mergin_with_context
    make_work_packages(ctx.wp_alg_dir, wp_config)
  File "/mergin-work-packages/workpackages/wp.py", line 304, in make_work_packages
    c.execute(f"""delete from {wp_tab_name_esc} where not {intersects_query}""")
sqlite3.OperationalError: no such column: geometry