Skip to content

Add region input to crop imagery for Ask Qwen task - #457

Open
annehaley wants to merge 12 commits into
masterfrom
task-region-input
Open

Add region input to crop imagery for Ask Qwen task#457
annehaley wants to merge 12 commits into
masterfrom
task-region-input

Conversation

@annehaley

@annehaley annehaley commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

This PR allows a user to specify a region as input to the Ask Qwen task. They may select a region related to a dataset in the current project or create a new region related to the project directly. The selected region input will be used to crop and mask the input imagery before encoding and sending to the qwen endpoint.

  • Updated Region model to add a project field. Exactly one of project or dataset must not be null. Region names must be unique among others in the dataset or project. The project_filter_path is set to "project|dataset__project" and querysets.filter_by_projects was updated to allow for multiple paths for a project relationship.
  • Updated Region API to enable write endpoints using a ModelViewSet with an override on perform_create to account for deserializing the coordinates.
    • Regions created via this endpoint do not have a related vector_feature, like the ones created during a dataset ingest do. We could create them in perform_create if we think we will use them for something in the future, but for now they're unnecessary. We only use a region's vector feature to serve vector tiles for a layer. Without a relationship to a layer, these regions don't need vector features. Instead, these regions are visualized with a specialized MapLibre layer in the client.
  • Updated imagery_ask_qwen.py to use a region input to crop and mask the image before sending to qwen.
  • Added terradraw to client dependencies for drawing a region on the map.
  • Updated AnalyticsPanel.vue to support regions as inputs and outputs. When regions are shown in a combobox dropdown, the user may hover over each item to see the region on the map. A specialized geojson MapLibre layer is used to visualize the regions. The same process is used to visualize them when the user clicks the "Show" button next to a region input or output in the "View Existing" tab.
  • The combobox for selecting a region in the "Run New" tab includes a button to create a new region. When clicked, a polygon draw event is triggered, and a label is shown below the combobox informing the user to click on the map to draw a polygon. When the polygon has been closed, a text input will appear below the combobox asking the user to name the region. After the name is submitted, the region object is created and selected in the combobox.

This video demonstrates the new client features. (I clipped out the time spent waiting on qwen's response.)
https://drive.google.com/file/d/1PFMii5qj_HueyjHbV70xGHOc_yzGlrC7/view?usp=sharing

Edit: this PR also includes a fix to ignore the "Type instantiation is excessively deep and possibly infinite" errors arising from using MapLibre nested types. This CI failure makes this change necessary.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 18, 2026

Copy link
Copy Markdown

Deploying geodatalytics with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8198f01
Status: ✅  Deploy successful!
Preview URL: https://7e68f29c.geodatalytics.pages.dev
Branch Preview URL: https://task-region-input.geodatalytics.pages.dev

View logs

@annehaley annehaley linked an issue Aug 19, 2026 that may be closed by this pull request
@manthey

manthey commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

The functionality works well (though I've failed at getting qwen to give good answers to the questions I've asked).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crop Imagery for Qwen Task

2 participants