hslayers / hslayers-ng

User interface and map building extensions for OpenLayers
https://ng.hslayers.org/
MIT License
36 stars 20 forks source link

Use map composition as a source for basemap gallery #3307

Closed fzadrazil closed 1 year ago

fzadrazil commented 2 years ago

Feature Request

Is your feature request related to a problem? Please describe. I am migrating map atlas portal which contains tens of map projects = compositions. Each of those maps has the same set of basemaps (there is 10 basemaps), only the default basemap changes through the projects.

Describe the solution you'd like It would be nice and helpful to create one "basemaps map composition" which would contain the set of all the basemaps and then be able to use this composition as a source of the basemaps for hslayers basemap gallery. There would be a new configuration parameter

basemaps: {
  sourceUrl: '<link to the map composition file>',
  default: 'name of the default visible basemap'
}

Describe alternatives you've considered Copy all the basemaps to all of the map compositions.

jmacura commented 2 years ago

Nice and clean solution might be extensible compositions.

Like

{
  title: "Basemaps",
  layers: [...]
}
{
  title: "My thematic composition 1",
  extends: "https://hub.lesprojekt.cz/micka/record/basic/m-3dcabe29-0bfa-4adc-9d44-d745365e8a1e",
  layers: [...]
}

Then all the properties from "Basemaps" composition would be merged also into "My thematic composition 1". On the other hand, this approach requires complex parsing of the composition definition + additional request calls for the compositions being extended.

fzadrazil commented 2 years ago

Nice and clean solution might be extensible compositions.

Hmm, that is a cool idea. That approach would cover even more use cases than just basemaps...

raitisbe commented 2 years ago

Why is duplication of basemaps between compositions a problem?

fzadrazil commented 2 years ago

Why is duplication of basemaps between compositions a problem?

It is not a problem at all. It just presents a tedious work for cases like this where you have a portal with 30+ compositions and all of them contain the same set of basemaps. But the more important issue here is that those compositions in fact doesn't have a logical link to those compositions. They are just a default set of basemaps that should be available in the map client. So it would make sense to be able to define this through configuration. It would give the portal administrator a change to easily define basemaps for any map s/he is creating at the portal through the CMS map widget. It could be implemented on the side of CMS for sure, but makes more sense to have it in hslayers itself. image

That is also the reason why I would stick with the original idea of a composition as a basemap source. In fact I found an inspiration in another online GIS that is using very similar mechanism. Extending compositions could be a really useful concept that is worth investigating further, but not for this specific use case.

jmacura commented 2 years ago

Why is duplication of basemaps between compositions a problem?

It is not a problem at all. It just presents a tedious work for cases like this where you have a portal with 30+ compositions and all of them contain the same set of basemaps.

TL;DR: Ease of use and maintainability are problems.

fzadrazil commented 2 years ago

Right, maintenance is also an important problem I forgot to mention. What if I need to change the set of basemaps. I would have to do it in all the compositions instead of just one basemap source.