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

Impossible to print with all the customized scales #585

Closed
catmorales opened this issue Dec 20, 2022 · 20 comments · Fixed by #618 or #619
Closed

Impossible to print with all the customized scales #585

catmorales opened this issue Dec 20, 2022 · 20 comments · Fixed by #618 or #619
Assignees
Labels
bug Something isn't working

Comments

@catmorales
Copy link
Collaborator

catmorales commented Dec 20, 2022

Describe the bug
Print maps at specific scales (between 1:4000 and 1:100) don't work.
It is a regression.
We didn't change the config.yaml parameter and with the last release, printing on specific scales don't work

To Reproduce
Steps to reproduce the behavior:

  1. Open https://portail-test.sig.rennesmetropole.fr/mapstore/
  2. Locate on "rue dupont des loges"
  3. Click on 'print plugin'
  4. Choice the scale 1:5000 in the preview, print--> preview is ok , pdf is ok
    image
  5. Go back and choice the 1:4000 scale in the list
    image

Preview is ok, Print --> pdf is bad scale is not the good one
image

Expected behavior
Print the map at the scale selected in the list

Desktop (please complete the following information):

Additional context
Add any other context about the problem here.

@catmorales catmorales added the bug Something isn't working label Dec 20, 2022
@catmorales
Copy link
Collaborator Author

@landryb , @jusabatier Do you have the same behaviour with the last release ?
@tdipisa Do we have some parameters to add or modify on print plugin ?

@jusabatier
Copy link
Contributor

Here it appear to work, in our conf we set :

{
"cfg": {
"useFixedScales": true,
"mapPreviewOptions": {
"enableScalebox": true
},
"overlayLayersOptions": {
"enabled": true
},
"overrideOptions": {
"geodetic": true
}
},
"override": {}
}

Not related, but we have A3 format selected by default on print plugin opening.
Is there a conf to use A4 as default at opening ?

@catmorales
Copy link
Collaborator Author

catmorales commented Dec 21, 2022

Yes we have the same.
Our config in localConfig.json is

{
				"name": "Print",
				"cfg": {
					"useFixedScales": true,
					"mapPreviewOptions": {
						"enableScalebox": true
					},
                                     "overlayLayersOptions": {
                                    "enabled": true
                                     },
					"overrideOptions": {
						"geodetic": true
					}
				}
			},

But the issue is just for the scales between 1:4000 and 1:100 however they are in the config.yml (I personally think that there are too many of them but it was a request from the product owner):


#===========================================================================
# the allowed scales
#===========================================================================
scales:
  - 100
  - 200
  - 250
  - 500
  - 1000
  - 1500
  - 2000
  - 2500
  - 3000
  - 4000
  - 5000
  - 6000
  - 7000
  - 8000
  - 9000
  - 10000
  - 12000
  - 14000
  - 16000
  - 18000
  - 20000
  - 25000
  - 30000
  - 35000
  - 40000
  - 50000
  - 100000
  - 250000
  - 500000
  - 1000000
  - 2500000
  - 5000000
  - 10000000

@tdipisa, is there a limited number of scales to use, now ?
@jusabatier , about the A4 by default in the localconfig.json, I have added in the section "Initial state" these parameters to initialize the default configuration of the print plugin

"initialState": {
		"defaultState": {
			"mapInfo": {"enabled": true, "infoFormat": "text/html"},
			"print": {
				"spec": {
					"antiAliasing": true,
					"iconSize": 24,
					"legendDpi": 96,
					"fontFamily": "Verdana",
					"fontSize": 8,
					"bold": false,
					"italic": false,
					"resolution": "96",
					"name": "Carte de Rennes Métropole",
					"description": "Impression standard",
					"sheet": "A4"
				}
			},

@catmorales
Copy link
Collaborator Author

@catmorales
Copy link
Collaborator Author

@tdipisa To give you more information, in the mapstore logs , I see

WARN 2022-12-21 08:41:17.539 org.ho.yaml.CustomBeanWrapper::setProperty:44 - LastPage: unknown field 'rotation' with value 'true'
org.apache.batik.transcoder.TranscoderException: null
Enclosed Exception:
etc
       at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(XMLAbstractTranscoder.java:136)
       at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(SVGAbstractTranscoder.java:156)
       at org.apache.batik.transcoder.print.PrintTranscoder.print(PrintTranscoder.java:307)
       at org.mapfish.print.config.layout.ImageBlock$SvgDrawer.renderImpl(ImageBlock.java:140)
       at org.mapfish.print.ChunkDrawer.render(ChunkDrawer.java:55)
       at org.mapfish.print.ChunkDrawer.tableLayout(ChunkDrawer.java:49)
       at com.itextpdf.text.pdf.PdfPTable.writeSelectedRows(PdfPTable.java:855)
       at com.itextpdf.text.pdf.ColumnText.goComposite(ColumnText.java:1978)
       at com.itextpdf.text.pdf.ColumnText.go(ColumnText.java:999)
       at com.itextpdf.text.pdf.ColumnText.go(ColumnText.java:993)
       at com.itextpdf.text.pdf.ColumnText.go(ColumnText.java:981)
       at com.itextpdf.text.pdf.PdfPRow.writeCells(PdfPRow.java:583)
       at com.itextpdf.text.pdf.PdfPTable.writeSelectedRows(PdfPTable.java:831)
       at com.itextpdf.text.pdf.ColumnText.goComposite(ColumnText.java:1978)
       at com.itextpdf.text.pdf.ColumnText.go(ColumnText.java:999)
       at com.itextpdf.text.pdf.ColumnText.go(ColumnText.java:993)
       at com.itextpdf.text.pdf.ColumnText.go(ColumnText.java:981)
       at com.itextpdf.text.pdf.PdfPRow.writeCells(PdfPRow.java:583)
       at com.itextpdf.text.pdf.PdfPTable.writeSelectedRows(PdfPTable.java:831)
       at com.itextpdf.text.pdf.PdfPTable.writeSelectedRows(PdfPTable.java:964)
       at com.itextpdf.text.pdf.PdfPTable.writeSelectedRows(PdfPTable.java:910)
       at com.itextpdf.text.pdf.PdfPTable.writeSelectedRows(PdfPTable.java:889)
       at org.mapfish.print.config.layout.ColumnsBlock$1.render(ColumnsBlock.java:67)
       at org.mapfish.print.PDFCustomBlocks.addAbsoluteDrawer(PDFCustomBlocks.java:186)
       at org.mapfish.print.config.layout.ColumnsBlock.render(ColumnsBlock.java:56)
       at org.mapfish.print.config.layout.Page.render(Page.java:80)
       at org.mapfish.print.config.layout.Layout.render(Layout.java:64)
       at org.mapfish.print.output.AbstractOutputFormat.doPrint(AbstractOutputFormat.java:31)
       at org.mapfish.print.output.PdfOutputFactory.print(PdfOutputFactory.java:58)
       at org.mapfish.print.MapPrinter.print(MapPrinter.java:176)
       at org.mapfish.print.servlet.MapPrinterServlet.doCreatePDFFile(MapPrinterServlet.java:385)
       at org.mapfish.print.servlet.MapPrinterServlet.createPDF(MapPrinterServlet.java:185)
       at org.mapfish.print.servlet.MapPrinterServlet.doPost(MapPrinterServlet.java:113)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:681)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
       at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
       at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:687)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:360)
       at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:399)
       at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
       at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:890)
       at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1789)
       at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
       at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
       at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
       at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
       at java.base/java.lang.Thread.run(Thread.java:829)
ERROR: null
Enclosed Exception:
null
Enclosed Exception:
etc

@landryb
Copy link
Member

landryb commented Dec 21, 2022

I can try to do a PR to add it in https://github.com/georchestra/mapstore2-georchestra/blob/master/configs/localConfig.json, if you want.

that'd be welcome so that one knows its possible.. but dont forget to also PR https://github.com/georchestra/datadir/blob/master/mapstore/configs/localConfig.json

@landryb
Copy link
Member

landryb commented Dec 21, 2022

@catmorales

WARN 2022-12-21 08:41:17.539 org.ho.yaml.CustomBeanWrapper::setProperty:44 - LastPage: unknown field 'rotation' with value 'true'`

im not sure this error messages is related to the scaling issue you see when printing (after all its just a warning), but it seems the existing config.yaml isnt accepted by the backend. rotation should be a valid property for an !image object in the backend, can you show us the corresponding extract of the printing/config.yaml file ?

@catmorales
Copy link
Collaborator Author

catmorales commented Dec 21, 2022

Yes you're right @landryb , it is not linked because I have the same message with a "good" PDF. So It 's difficult for me to track the scaling issue becaus e I don't see anything in the console's browser neither in Mapstore logs.
This warning should occurs because rotation is at true in the config.yaml ?:

Layouts:
  #=======A4 portrait with legend=============================================
  A4 :
  #===========================================================================
    mainPage:
      rotation: true
      pageSize: 595 842 
      landscape: false
      items:
...
            - !columns
          absoluteX: 370
          absoluteY: 140
          width: 40
          items:
            - !image
              maxWidth: 40
              maxHeight: 40
              url: 'file:/${configDir}/Arrow_North_CFCF.svg'
              rotation: '${rotation}'     
...

I don't remember but I think, I am using a copy of the mapfishapp config.yaml

@tdipisa
Copy link
Collaborator

tdipisa commented Dec 22, 2022

@tdipisa To give you more information, in the mapstore logs , I see

WARN 2022-12-21 08:41:17.539 org.ho.yaml.CustomBeanWrapper::setProperty:44 - LastPage: unknown field 'rotation' with value 'true'
org.apache.batik.transcoder.TranscoderException: null
Enclosed Exception:
etc
       at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(XMLAbstractTranscoder.java:136)
       ...
       at java.base/java.lang.Thread.run(Thread.java:829)
ERROR: null
Enclosed Exception:
null
Enclosed Exception:
etc

@catmorales I don't think the rotation parameter can be used inside the config.yaml used by MS. It is supported by the print lib used by MS but it is not currently supported by the frontend application: it is not sent in the body of the print request, therefore I think this error is normal.

@tdipisa
Copy link
Collaborator

tdipisa commented Dec 23, 2022

@tdipisa To give you more information, in the mapstore logs , I see

WARN 2022-12-21 08:41:17.539 org.ho.yaml.CustomBeanWrapper::setProperty:44 - LastPage: unknown field 'rotation' with value 'true'
org.apache.batik.transcoder.TranscoderException: null
Enclosed Exception:
etc
       at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(XMLAbstractTranscoder.java:136)
       ...
       at java.base/java.lang.Thread.run(Thread.java:829)
ERROR: null
Enclosed Exception:
null
Enclosed Exception:
etc

@catmorales I don't think the rotation parameter can be used inside the config.yaml used by MS. It is supported by the print lib used by MS but it is not currently supported by the frontend application: it is not sent in the body of the print request, therefore I think this error is normal.

Dear @catmorales, I've checked and the rotation parameter is effectively present both in the body of the create.json request (always set to 0) and in the default config.yaml of MS. I'm sorry about that, my fault.
I've tried to reproduce the steps you described in this issue and it is effectively a bug that need to be fixed MS side.

@catmorales
Copy link
Collaborator Author

catmorales commented Jan 5, 2023

News : reducing the number of scales, it works (less than 23 scales) !
I repeat my question : @tdipisa, is there a limited number of scales to use, now ?

@tdipisa
Copy link
Collaborator

tdipisa commented Jan 9, 2023

I repeat my question : @tdipisa, is there a limited number of scales to use, now ?

No, but there is a small bug to fix on how scales are handled after a certain value (see my comment above)

@catmorales
Copy link
Collaborator Author

Ok thank you, when do you think the small bug will be fixed ?

@tdipisa
Copy link
Collaborator

tdipisa commented Jan 10, 2023

Ok thank you, when do you think the small bug will be fixed ?

Since this issue is linked in the list of things for MS4, last time I've commented I've put also an estimate there for the fix.

@catmorales
Copy link
Collaborator Author

So, if I understand well, you will fix it with issue #582

@tdipisa
Copy link
Collaborator

tdipisa commented Jan 11, 2023

So, if I understand well, you will fix it with issue #582

#582 is another task @catmorales, the issue is this one and estimated are at row 38 of the shared document. Anyway, since it seems you have found a way to workaround the original topic involving annotation reported at row 38, you can maybe create a new issue describing that problem and put it in the shared document so that we can finally estimate it too.

dsuren1 added a commit to dsuren1/mapstore2-georchestra that referenced this issue May 18, 2023
tdipisa pushed a commit that referenced this issue May 22, 2023
* #585: Print layer with visibility limits applied

* Revert version
tdipisa pushed a commit that referenced this issue May 23, 2023
* #585: Print layer with visibility limits applied

* Revert version
tdipisa pushed a commit that referenced this issue May 23, 2023
* #585: Print layer with visibility limits applied

* Revert version
tdipisa added a commit that referenced this issue May 24, 2023
Print layer with visibility limits applied #585
@tdipisa tdipisa closed this as completed Jun 1, 2023
@catmorales
Copy link
Collaborator Author

catmorales commented Jun 2, 2023

@tdipisa Thank you very much for the correction.
Could you create a docker image 2022.02.02-georchestra release or update 2022.02.xx on https://hub.docker.com/r/geosolutionsit/mapstore2-georchestra/tags, please ?

@tdipisa
Copy link
Collaborator

tdipisa commented Jun 5, 2023

@tdipisa Thank you very much for the correction. Could you create a docker image 2022.02.02-georchestra release or update 2022.02.xx on https://hub.docker.com/r/geosolutionsit/mapstore2-georchestra/tags, please ?

@catmorales the stable branch has been already updated 2w ago with this fix. We have in plan to release v2022.02.02-geOrchestra shortly. As par of this we will publish the updated docker image. I will keep you posted on the progress.

@tdipisa
Copy link
Collaborator

tdipisa commented Jun 5, 2023

@catmorales the new release is available here.

@catmorales
Copy link
Collaborator Author

Thanks a lot @tdipisa. We will test it asa.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
5 participants