New toolbar button: Center on user's geolocation#626
New toolbar button: Center on user's geolocation#626gjmooney merged 15 commits intogeojupyter:mainfrom
Conversation
2e6c34b to
d2ed785
Compare
|
This looks fine with me. Small nitpick: it seems that when we reach the maximum zoom level after clicking multiple times, it circles back to the minimum zoom level. |
|
Integration tests report: appsharing.space |
Yes. That a choice I made but I can change this. And do nothing instead of centering and setting the zoom to 0. Here is the current implementation: private _handleGeolocationChanged(
sender: any,
newPosition: JgisCoordinates
): void {
const view = this._Map.getView();
const zoom = view.getZoom();
if (zoom !== undefined && zoom + 2 < 20) {
this._moveToPosition(newPosition, zoom + 2);
} else {
this._moveToPosition(newPosition, 0);
}
} |
Maybe we should just center the map at the current location and not change the zoom level. |
Thanks for your suggestion @SylvainCorlay . It has been taken into account |
6b8a6d0 to
5aed8da
Compare
1771158 to
a498331
Compare
|
Ahh there are more failures, the above import error was just one of them |
|
Bot please update snapshots |
1 similar comment
|
Bot please update snapshots |
018731e to
ab3ab6d
Compare
|
Bot please update snapshots |
c00d2f3 to
c36736a
Compare
- a new command button in the toolbar - a command for getting the geolocation of the user - a geolocation attribute and a geolocationChanged signal to the JupyterGISModel - centering and zooming around the geolocation
Add missing import of Feature in mainView.tsx.
…tGeolocation command. Rename previous svg file and related targetIcon to targetWithoutCenterIcon.
for more information, see https://pre-commit.ci
Co-authored-by: Arjun Verma <arjunverma.oc@gmail.com>
Use getByTestId in geojson-layers.spec.ts.
c36736a to
15ff70c
Compare
arjxn-py
left a comment
There was a problem hiding this comment.
Thanks @HaudinFlorence, this is super awesome 🚀
Just a couple of questions and a suggestion :)
ui-tests/tests/layer-browser.spec.ts
Outdated
| const content = galata.newContentsHelper(request); | ||
| await content.deleteDirectory('/testDir'); | ||
| await content.uploadDirectory( | ||
| const uploaded = await content.uploadDirectory( |
There was a problem hiding this comment.
No, this is not. This is a left-over of some tests. I will remove it.
ui-tests/tests/layer-browser.spec.ts
Outdated
|
|
||
| test.beforeEach(async ({ page }) => { | ||
| await page.filebrowser.open('testDir/test.jGIS'); | ||
| const opened = await page.filebrowser.open('testDir/test.jGIS'); |
There was a problem hiding this comment.
Just curious if this is required?
There was a problem hiding this comment.
As previously explained. This is not. I will remove it.
| } | ||
| }); | ||
|
|
||
| commands.addCommand(CommandIDs.getGeolocation, { |
There was a problem hiding this comment.
Can you think of a scenario where we'd want to disable this button? In those cases we'd want to handle those in isEnabled
There was a problem hiding this comment.
You are rising an interesting point. In a version where the geolocation would be materialized by a marker on the map, we can imagine that the command is enabled only when there is no marker on the map yet. Or we could imagine a version with a toggle command toolbar button or a toggable custom layer. In any case, this PR addresses a first simple geolocation feature that will be improved in a future PR.
Co-authored-by: Arjun Verma <arjunverma.oc@gmail.com>
|
@arjxn-py Thanks for the review |
There was a problem hiding this comment.
Should probably delete this
Co-authored-by: Greg Mooney <gregory.mooney@quantstack.net>
|
@gjmooney Thanks for the review. I have taken all your comments into account. |
131f16b to
efd9830
Compare
* Add logics for geolocation including : - a new command button in the toolbar - a command for getting the geolocation of the user - a geolocation attribute and a geolocationChanged signal to the JupyterGISModel - centering and zooming around the geolocation * Change the label of getGeolocation command. Add missing import of Feature in mainView.tsx. * Remove zooming around relocation in _handleGeolocationChanged function. * Update target.svg fill and class properties to adapt to both themes. * Update getGeolocation command label. * Add a targetWithCenterIcon and replace targetIcon with this one in getGeolocation command. Rename previous svg file and related targetIcon to targetWithoutCenterIcon. * Fix lint issues. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update packages/base/src/mainview/mainView.tsx Co-authored-by: Arjun Verma <arjunverma.oc@gmail.com> * Fix icon path issues * Add test ids to the various command toolbar buttons. Use getByTestId in geojson-layers.spec.ts. * Update ui-tests/tests/geojson-layers.spec.ts Co-authored-by: Arjun Verma <arjunverma.oc@gmail.com> * Update packages/base/src/toolbar/widget.tsx Co-authored-by: Greg Mooney <gregory.mooney@quantstack.net> * Take review comments into account. * Fix failing lint test. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Arjun Verma <arjunverma.oc@gmail.com> Co-authored-by: arjxn-py <arjxn.py@gmail.com> Co-authored-by: Greg Mooney <gregory.mooney@quantstack.net>
Description
This PR adds logics for getting the geolocation and centering the map on it. Changes includes adding:
getGeolocationfor getting the geolocation of the user using the geolocation API from Chromegeolocationattribute and ageolocationChangedsignal to the JupyterGISModelScreencast.From.2025-04-16.12-22-07.mp4
📚 Documentation preview: https://jupytergis--626.org.readthedocs.build/en/626/
💡 JupyterLite preview: https://jupytergis--626.org.readthedocs.build/en/626/lite