-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Manual bbox entry option to search page #389
base: main
Are you sure you want to change the base?
Add Manual bbox entry option to search page #389
Conversation
src/components/BBoxEntry.vue
Outdated
<b-form-group> | ||
<b-form-row> | ||
<b-col> | ||
<b-form-group label="x_min" label-for="x_min"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how this is usually done in forms, but x_min seems a little too technical as a user readable label.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I asked around and didn't find a clear answer. I could do something like Lat max/min and Lon max/min. Would that be clearer to most users?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe follow the specification terms? I guess there are names hidden in the API spec documents.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. Is the bbox synced between map and form inputs? |
The coordinates drawn with the area select on the map sync to the form inputs. I.e. a user can draw a box, and then switch to the form input and continue to manually edit them. Unless I missed something, the areaSelect doesn't accept a starting bounding box to visually set the handles. Right now, switching from the form inputs back to the bounding box resets the query.bbox value back to the default, so a user would need to re-draw. The different behaviors does feel strange. I could make it reset any time a user changes tabs to be consistent. Ideal scenario might be updating the the areaSelect to display the bounds and show both manual and visual map entries at the same time with state synced instead of on separate tabs. |
I guess the area select tool needs some work so that it can be synced. It's a very simple thing that I found on the internet, but I guess others have solved that better somewhere... |
with the latest update, submitting the search will submit the bbox on whichever tab was last edited. i.e. if a user edits with the manual entry, then switches to the map tab without drawing there, the bbox used in the search is still the one from the manual text entry. The area select still does not update what is displayed, though. |
Co-authored-by: Matthias Mohr <[email protected]>
…rowser into manual-bbox-entry
ok, I added a commit that gave the area select an setInitialBounds method. That will set the area box height and width to the same value manually entered on the manual entry tab |
src/components/BBoxEntry.vue
Outdated
<b-container> | ||
<b-form-row> | ||
<b-col> | ||
<b-form-group label="Southwest Latitude" label-for="sw_latitude"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The labels needs to be added to the locales.
@@ -36,6 +38,20 @@ L.AreaSelect = L.Class.extend({ | |||
return this; | |||
}, | |||
|
|||
setInitialBounds: function ( bounds) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just found my old code from another tool again:
setBounds: function(bounds) {
if (Array.isArray(bounds) && bounds.length >= 4) {
bounds = L.LatLngBounds([bounds[0], bounds[1]], [bounds[2], bounds[3]]);
}
this.map.fitBounds(bounds);
var bottomLeft = this.map.latLngToContainerPoint(bounds.getSouthWest());
var topRight = this.map.latLngToContainerPoint(bounds.getNorthEast());
this.setDimensions({
width: Math.abs(bottomLeft.x - topRight.x),
height: Math.abs(bottomLeft.y - topRight.y)
});
},
Here's the whole code for reference:
https://github.com/Open-EO/openeo-web-editor/blob/5ec303fc023b5a745254ea34f6218337fed89ae7/src/components/leaflet-areaselect/leaflet-areaselect.js
I think this might be a bit more universal and supports the Leaflet Bounds for consistency with getBounds. Would you mind updating it?
Thanks for the updates. Left a couple of comments, but otherwise looks good. |
thanks for reviewing @m-mohr - comments addressed. Things are working when I test locally against |
I was not moving the map to center on the manually entered bounding box when a user went back to the map view. I added to commits with a few changes to address that bug and other potential ones:
|
Hey there, Also, for these smaller extents I believe the map should be zoomed to roughly fit to the extent and only then the bbox should be drawn. Otherwise it looks like this: The main paint point here is the bad bbox chooser. Ideally we'd get a better one... |
As requested in PR #302 , This is breaking out a new feature into its own PR.
This PR is intended to add a new BBEntry component that allows the entry of [
x_min, y_min, x_max, y_max]
instead of using a bounding box selection on the map. This new component should help accessibility and help make it clear the coordinates being searched by a user.The default behavior on the search page is still to show the areaSelect Component if a user checks the
Filter by spatial extent
option. However, now there is a radio button option to toggle to "Enter coordinates". This option hides the area select and allows a user to manually enter the coordinates.The input boxes are limited to numbers ±180 or ±90 via the bootstrap input component.
I did add two English terms that would need translations. If there is a way for me to request that via crowdin, then I can do that: