MerginMaps / MerginMaps/work-packages

Filtering by geometry requires column named "geometry"

Open
#52 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
11
Forks
6
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in workpackages/wp.py around lines 303-304 and inspect make_work_packages, where the filtering query is assembled. Reproduce the failure with a geometry column named geom rather than geometry, then verify that geometry filtering works without requiring the hard-coded column name.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, sqlite
Domain
databases
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.