pacificclimate / scip-frontend

Salmon Climate Impacts Portal
GNU General Public License v3.0
1 stars 1 forks source link

click on the map to select all points upstream #54

Closed corviday closed 9 months ago

corviday commented 11 months ago

Users may select an area of interest using the circlemarker tool on the map and then clicking on the map; this will select the region upstream of the selected point.

This PR also removes drawing the upstream stream network on the map. We aren't get doing meaningful visualization with it yet, and people found it distractingly busy, unfortunately.

Demo here.

I will lint changed files after review.

resolve #49 resolve #2 resolve #43

corviday commented 11 months ago

one issue I've run into testing just now is that it is possible to select an area with so many vertices that sending it to the PCEX backend results in a request too long to be processed.

For example, if you click on -122.46875+52.53125, the resulting requests)) to the backend return the error message

Bad Request
Request Line is too large (8192 > 4094) 

Possible fixes:

  1. change gunicorn's request line size - the best option if it works, but the backend may not be able to handle a shape this complex either
  2. just tell the user to pick another region, that one is too complex
  3. shorten the string in the front end some easy way, perhaps by rounding all the decimals
  4. shorten the string in the front end some better way, by using some kind of simplification algorithm
corviday commented 10 months ago

The PCEX backend has been modified to accept extra-long polygons as request paylods. Just need to update this front end.

And maybe the SCIP backend as well?

corviday commented 10 months ago

Searching for a request-making library that will let me send a GET request with a body.

corviday commented 10 months ago

No library seems to be able to make a GET request with a body; possibly browsers do not allow it. Accordingly, have shifted tactics to accept POST requests instead.

corviday commented 9 months ago

Demo

rod-glover commented 9 months ago

Before I review further, a question: Your PR and the in-app instructions say "place a marker and select everything upstream of it", but it looks to me like the map displays the downstream path. Examples:

Screenshot from 2023-11-15 14-47-38 Screenshot from 2023-11-15 14-49-11 Screenshot from 2023-11-15 14-49-42

Can you clarify?

corviday commented 9 months ago

The area of interest, whether selected from a dropdown or by clicking on the map, is outlined in white. It's pretty small on your selection because most points on the map have only a couple grid squares upstream, if there's even anything upstream of them, so in most cases unless you click on a visible river, it's just a grid cell or two.

The blue outline shows the downstream path to the sea. Salmon scientists have indicated this is a useful thing to show on the map, though as of yet we are not offering any indicator data long this route. Hope to someday.

rod-glover commented 9 months ago

Ah, I see. Thanks. I wonder if a different colour would lower this confusion. Also, perhaps instead, in the instructions, add a note that the map shows (a) the downstream path in blue, and (b) the upstream polygon in white|whatever.

corviday commented 9 months ago

I am wondering if it might help to make the circle marker where you click white (to match the boundary of the watershed you've chosen) instead of the default blue (which matches the downstream line). That way there would be a visual connection between the clicked location and the watershed.

rod-glover commented 9 months ago

That would help, too. I do also recommend making the "instructions" below the map more explicit with something like what I suggested.

QSparks commented 9 months ago

The demo looks great Lee! I like that the marker size changes with the zoom level.

During testing, I discovered a bug while using the Edit layers option. This option allows a marker that has been placed on the map to be moved without the changes being reflected in the upstream selection.

An additional suggestion for clarity is that for the Delete layers option, it looks like both “save” and “clear all” have the same behavior. If saving isn’t important here the options could be reduced to either clear all or cancel.

corviday commented 9 months ago

UI Improvements: Removed the "edit layers" button. After research, I am not sure how to get rid of the "save" menu option, so I might kick that to a separate issue. Added text explaining that the selected area is outlined in white.

corviday commented 9 months ago

In the latest demo, the basins(?) don't show up, whereas before IIRC they were filled in purple. Was that intentional?

Yes. We were requested to remove the upstream flow network visualization, which was a collection of lines that, when zoomed out, made the whole selected area look blue. I think it was neat and I am sorry to see it go, but we weren't providing any information about it at this point (though we will someday); it was purely decorative.