Skip to content
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

Adds support for georeferenced coordinates. #133

Merged
merged 64 commits into from
Aug 28, 2023
Merged

Conversation

arjo129
Copy link
Member

@arjo129 arjo129 commented May 25, 2023

New feature implementation

Implemented feature

Adds support for visualizing OSM maps and using Geographic coordinates (Lat/Lon) instead of just (x, y) coordinates.

To use:
Go to tools->Georeference->Set Reference.... Enter latitude and longitude of reference. Press Set Reference. You should see the maps loading.
You may also set reference via anchor or move an anchor to a specified latitude/longitude using Move To Lat/Lon
You can adjust the map resolution using the bottom slider.
To view an offset you can use the Tools->Georeference->View Reference as UTM.
Screenshot from 2023-06-15 13-04-39

Known Issues

  • We really should switch to Proj, but for now we use the utm crate because Proj's rust binding does not yet support WASM
  • Map tiles should ideally be drawn in web mercator frame, however this would require us to warp the units of our building graph to support web mercator and then have those warped back to UTM.
  • Changing resolution causes tiles to despawn and respawn. It would be better if the effect usses a fade in-fade out animation.
  • Currently we use OSM's main service. Ideally we should be able to switch tile providers in the future.

Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
@arjo129 arjo129 linked an issue May 25, 2023 that may be closed by this pull request
arjo129 added 15 commits May 25, 2023 13:02
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
This commit does the following:
* moves everything into a self contained plugin
* allows the system to work with File > New/Open
* redraw tiles if reference is changed

Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
@arjo129 arjo129 marked this pull request as ready for review June 15, 2023 05:56
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
@arjo129
Copy link
Member Author

arjo129 commented Aug 23, 2023

I've reworked the implementation significantly for this iteration and significantly simplified the user experience. It is probably ready for another round of review. The gaps between tiles have been eliminated. There are several ways to use this feature.

  1. By loading an existing world.

You may download an existing world here and open it. You should be able to see the world in the screen like so (notice no more gaps):

image

You should also be able to toggle visibility from the "view" checklist. To enable this I added an API that allows us to extend menus via the ECS like what was done in #163

Screencast.from.2023-08-23.10-35-10.webm

You may also view the reference from the tools menu and change the tile reference via the settings. Note: There is a hard-coded tile limit setting the code (this is to prevent the cache size from exploding and us from hammering the OSM server). We should make this configurable in a future PR.
Screencast from 2023-08-23 10-38-32.webm

  1. From a world without any existing reference.

We can use the example world. Open the Tool > Set reference panel. This should allow you to set an origin latitude and longitude.
image

You may also use the Inspect Anchor tool to move anchors to desired latitudes and longitudes.
image

We don't yet support using an anchor as a reference (that'll be a follow up PR) and we don't support lat/lon in the inspect Lane dialog (Also should be a follow up dialog).

As for the default world, I've not added its coordinates to this PR.

Signed-off-by: Michael X. Grey <[email protected]>
Copy link
Collaborator

@mxgrey mxgrey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This new feature is very awesome! I've left feedback on some minor details, but fundamentally these changes are excellent.

rmf_site_format/src/asset_source.rs Outdated Show resolved Hide resolved
rmf_site_editor/src/osm_slippy_map.rs Outdated Show resolved Hide resolved
rmf_site_editor/src/osm_slippy_map.rs Outdated Show resolved Hide resolved
rmf_site_editor/src/site/georeference.rs Outdated Show resolved Hide resolved
rmf_site_editor/src/site/georeference.rs Outdated Show resolved Hide resolved
rmf_site_format/src/asset_source.rs Outdated Show resolved Hide resolved
rmf_site_format/src/asset_source.rs Outdated Show resolved Hide resolved
@arjo129 arjo129 requested a review from mxgrey August 25, 2023 23:25
Signed-off-by: Michael X. Grey <[email protected]>
Copy link
Collaborator

@mxgrey mxgrey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tweaked the syntax here to make it a bit nicer: b7b452e

Thanks for this feature, this is awesome!

@mxgrey mxgrey merged commit b4e7e69 into main Aug 28, 2023
5 checks passed
@mxgrey mxgrey deleted the arjo/feat/georeference branch August 28, 2023 04:30
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.

Support Geographical Coordinates
4 participants