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

[WIP] Make the mosaic map endpoint more interactive #89

Closed
wants to merge 7 commits into from

Conversation

hrodmn
Copy link
Contributor

@hrodmn hrodmn commented May 19, 2023

Goals:

  • Use local map.html file instead of importing one from titiler
  • Add a tile specification panel to the map that allows you to specify assets, rescale, colormap, etc (similar to raster STAC item viewer)
  • If you add those parameters to the url (e.g. ...{searchid}/map?assets=cog&rescale=0,1000, those parameters get pre-loaded
  • When you load the map endpoint without any map parameters, load the basemap with the bbox for the searchid and prompt the user to provide the tile specification in the toolbar
  • Add a tile layer control to make it possible to toggle the tiles on/off

Resolves #79

@hrodmn hrodmn changed the title Make the mosaic map endpoint more interactive [WIP] Make the mosaic map endpoint more interactive May 19, 2023
@hrodmn
Copy link
Contributor Author

hrodmn commented May 19, 2023

The tests are failing because these changes require titiler>=0.11.7 but titiler-pgstac requires titiler<11. Updates to titile-pgstac to allow titiler>11 are in progress here: stac-utils/titiler-pgstac#93.

@vincentsarago
Copy link
Member

@hrodmn I'm sorry I haven't looked at this PR earlier.

I fixed some dependency issue and added by default the /map endpoint from titiler-pgstac. I think it will be easier to do a clear restart for the new /map` endpoint you're envisioning.

@hrodmn
Copy link
Contributor Author

hrodmn commented Jun 21, 2023

@vincentsarago no worries! And thanks for letting me know about the recent updates. I got a rudimentary version of the asset picking UI working a few weeks ago but had to put it down in favor of other work. I'll take a look at your recent updates later today.

@hrodmn
Copy link
Contributor Author

hrodmn commented Jun 26, 2023

I've got a basic version of the interactive mosaic endpoint running locally! I still need to add some logic to handle assets that consist of multi-band COGs but I have some ideas on how to handle it.

Single-band view:
image

Three-band:
image

###############################################################################
# MOSAIC Endpoints
# https://github.com/developmentseed/titiler/blob/main/src/titiler/extensions/titiler/extensions/viewer.py#LL21C1-L42C1
@dataclass
class mosaicViewerExtension(FactoryExtension):
Copy link
Member

Choose a reason for hiding this comment

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

can we put this in an extension.py submodule? (helps to keep app clean)

extensions=[
mosaicViewerExtension(),
],
layer_dependency=AssetsBidxExprParamsOptional,
Copy link
Member

Choose a reason for hiding this comment

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

why do we need to change this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This way you can navigate to the /map endpoint without specifying any parameters. Before I made this change I had to specify some parameters in the url in order to view the map (e.g. .../map?assets=layer_name). If I did not specify the layers I got this error message: {"detail":"assets must be defined either via expression or assets options."}.

Now, when you navigate to the /map endpoint you land in the mosaic browser web map and use the interactive menu to load specific layers rather than encoding them in the URL.

Copy link
Member

Choose a reason for hiding this comment

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

that's pretty dangerous because the layer_dependency is also used in other endpoints. I think it will be better to not change it and use a custom parameter in the extension (I can do it if needed)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah I see what you mean. I'll try to find an alternative way around it!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@vincentsarago can we drop the layer_dependency arg from the register() method for the new extension? Or should we have it set to a different value there rather than inheriting from the parent factory?
https://github.com/ncx-co/eoAPI/blob/db40b59c2ef0b0c26dca5ebb37c9d8a51576a115/runtime/eoapi/raster/eoapi/raster/extension.py#L58

Copy link
Member

Choose a reason for hiding this comment

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

I was going to push some change to this PR but I have couple question:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We may not need to pass the tilejson url, that could be left over from when I was first getting oriented.

I think a separate endpoint is a great idea! I can start making the switch to a /viewer (or /browser?) endpoint.

Copy link
Member

Choose a reason for hiding this comment

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

let's use /viewer (it's what we use in other endpoints) 👍

@hrodmn
Copy link
Contributor Author

hrodmn commented Jun 27, 2023

I am sorry about the force pushes here but I wanted to rebase this PR on main so I can make sure it is compatible with the mosaic builder!

@hrodmn
Copy link
Contributor Author

hrodmn commented Nov 1, 2023

I am closing this out since I have not had a chance to work on it in many months - might revisit later!

@hrodmn hrodmn closed this Nov 1, 2023
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.

[Custom runtimes] Make the mosaic map endpoint more interactive
2 participants