stac-browser icon indicating copy to clipboard operation
stac-browser copied to clipboard

Store some state in URL

Open m-mohr opened this issue 3 years ago • 2 comments

A list of potential things to have state for in the URL (ordered by priority):

  • [ ] Item pagination: The page currently loaded/shown
  • [ ] shown asset on map / preview (we may want to wait for the asset-related changes in stac-layer?)
  • [ ] Catalogs / Items: view mode (tiles or list) and sort order (asc, desc), maybe search term for catalogs
  • [ ] Expanded collapsibles
    • [x] Assets
    • [ ] Providers
  • [ ] map state (position, zoom level, ...)

Stretch goal:

  • [ ] Search/Item Filter: The whole list of filters, extents, items per page etc. (with auto submission of the form?)

May help: https://github.com/buhrmi/vue-sync

m-mohr avatar Mar 23 '22 12:03 m-mohr

Re item pagination With the current approach for pagination you'd probably need to serialise the whole page ref object, eg

{
   href: ".../collections/landsat-8-c2-l2/items?limit=12&token=next:LC08_L2SP_197052_20220324_02_T1"
   method: "GET"
   rel: "next"
   type: "application/geo+json"
}

It's doable but ppl are going to have some crazy long urls. To avoid that we could look at creating a url shortening services (basically just shove the big json object with all the required bits in S3 stored under a UID and load from that when required). But that obviously requires introducing some server-side component somewhere.

rowanwins avatar Jul 08 '22 01:07 rowanwins

Yes, indeed. Although you may only need to serialize parts of it. In this case probably just ?limit=12&token=next:LC08_L2SP_197052_20220324_02_T1. You need to compare URLs to figure out what differs and add that. But we had crazy long URLs in STAC Browser v2 so if we have crazy long URLs for pagination that is fine. I don't think we need a server-side component for this.

m-mohr avatar Jul 08 '22 13:07 m-mohr