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

Show credits/attribution text in printed page #10279

Closed
14 tasks
ale-cristofori opened this issue May 6, 2024 · 5 comments · Fixed by #10451 or #10461
Closed
14 tasks

Show credits/attribution text in printed page #10279

ale-cristofori opened this issue May 6, 2024 · 5 comments · Fixed by #10451 or #10461

Comments

@ale-cristofori
Copy link
Contributor

ale-cristofori commented May 6, 2024

Description

At the moment the textual attribution, credit or copyright statement are not visible on the printed map. The default attribution can be shown in OSM, they can come from WMS or other sources and can be customized for the WMTS bg layers with the MS UI. The text in question appears on the screen and on the map print preview but not on the resulting printed map. See below for an example:

recording_1.mp4

Acceptance criteria

  • As a MapStore USER with a role that allows me to edit a BG layer I edit the attribution text of a WTMS layer, I then click on the print button and open the print dialog window, when clicking on print I should be able to see the edited text appearing on the printed page.
  • As a MapStore USER I Open a map and I visualize as BG layer OSM, the usual OSM attribution as well as any other attribution text appearing on the bottom of the map, when I click on print the text appears on the map print preview and it will also appear on the printed Map.

Attribution can be found not only on BG layers but also on overlays, in that case the text is cumulative (one attributions for each text requiring it)

The solutions found needs to be as dynamic as possible, a solution that could fit all the text in a text box to be shown on the map, without cutting it. Another solution, if the text is too long is to provide it separated from the map, on a separate page.

Other useful information

A possible solution consist of:

  • edit PluginsUtils.getMapfishPrintSpecification in order to provide a list for credits, one credit per layer in the application state (state.layers), as a string separated via a separator character like | ...
  • this "credits" info will be passed to the config.yaml (empty by default)
  • credits in mapstore needs to be parsed removing the <a> tags and | inside, | can be simply removed
  credits: {
    title: 'OSM Simple Light | Rendering <a href="https://www.geo-solutions.it/">GeoSolutions</a> | Data © <a href="http://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="http://www.openstreetmap.org/copyright">ODbL</a>'
  }
  • edit config.yaml to show this new !text like this example, the positions has to be determined
- !columns
          absoluteX: 30  --> TO_EDIT
          absoluteY: 740 --> TO_EDIT
          width: 395 --> TO_EDIT
          widths: [395] --> TO_EDIT
          items:
            - !text
              align: left
              vertAlign: middle
              fontSize: 14 --> TO_EDIT 9 or 8 
              text: '${credits}'
  • add this for every layout just below the map (a few pixels down if possible) and evaluate if others pieces needs to be moved.
  • add migration guidelines on how to update it since many projects have a dedicated config.yaml (which could be identical to the mapstore one)
  • prepare a map for the test and add the exported json in the related issue (that's for functional tests) [map (11).json]
  • make various tests
    • with many layers 10 or 20
    • with a few layers long credits
    • a mix of previous
    • if the various scenarios are having layout / display issues, move all credits to a dedicated page
@tdipisa tdipisa assigned MV88 and unassigned MV88 May 6, 2024
@tdipisa tdipisa modified the milestones: 2024.02.00, 2024.01.02 Jun 24, 2024
mahmoudadel54 added a commit to mahmoudadel54/MapStore2 that referenced this issue Jul 3, 2024
Description:
- add credit layer values to print configration object to send it to the server
- create a util function to parse credit text by removing tags and | symbol
- edit config.yaml of print
- add migration guide
- add unit test
@mahmoudadel54 mahmoudadel54 linked a pull request Jul 3, 2024 that will close this issue
12 tasks
@MV88 MV88 added the BackportNeeded Commits provided for an issue need to be backported to the milestone's stable branch label Jul 3, 2024
@MV88
Copy link
Contributor

MV88 commented Jul 3, 2024

@mahmoudadel54 hi,

can you provide more info about this point, it can be a map in dev or a json of an exported map

prepare a map for the test and add the exported json in the related issue (that's for functional tests)

@mahmoudadel54
Copy link
Contributor

@mahmoudadel54 hi,

can you provide more info about this point, it can be a map in dev or a json of an exported map

prepare a map for the test and add the exported json in the related issue (that's for functional tests)

Hi @MV88
Actually I was working locally with local layers to test. But let me prepare a Dev map and I will put its json here

@MV88
Copy link
Contributor

MV88 commented Jul 3, 2024

@mahmoudadel54 hi,
can you provide more info about this point, it can be a map in dev or a json of an exported map

prepare a map for the test and add the exported json in the related issue (that's for functional tests)

Hi @MV88 Actually I was working locally with local layers to test. But let me prepare a Dev map and I will put its json here

thanks, please put a link here and in the issue description

@mahmoudadel54
Copy link
Contributor

mahmoudadel54 commented Jul 3, 2024

These are sample of showing credits [long content] in print page
image

image

@mahmoudadel54
Copy link
Contributor

mahmoudadel54 commented Jul 3, 2024

This is a test map, I have added many layers with credits you can see on it.

map (11).json

I have added it in the issue description as well
@MV88

MV88 pushed a commit that referenced this issue Jul 5, 2024
* #10279: Show credits/attribution text in printed page
Description:
- add credit layer values to print configuration object to send it to the server
- create a util function to parse credit text by removing tags and | symbol
- edit config.yaml of print
- add migration guide
- add unit test
@ElenaGallo ElenaGallo self-assigned this Jul 5, 2024
mahmoudadel54 added a commit to mahmoudadel54/MapStore2 that referenced this issue Jul 8, 2024
…eosolutions-it#10451)

* geosolutions-it#10279: Show credits/attribution text in printed page
Description:
- add credit layer values to print configuration object to send it to the server
- create a util function to parse credit text by removing tags and | symbol
- edit config.yaml of print
- add migration guide
- add unit test
@tdipisa tdipisa removed the BackportNeeded Commits provided for an issue need to be backported to the milestone's stable branch label Jul 8, 2024
tdipisa pushed a commit that referenced this issue Jul 8, 2024
* #10279: Show credits/attribution text in printed page
Description:
- add credit layer values to print configuration object to send it to the server
- create a util function to parse credit text by removing tags and | symbol
- edit config.yaml of print
- add migration guide
- add unit test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment