Hello everyone,

Not sure if this is the right place for this topic, but I did not found any
Mapfish mailing list or similar.

I have a problem with printing layers on concrete scale. For example, I
send request as below:

{

   "layout":"A4 portrait",

   "outputFormat":"pdf",

   "outputFilename":"test",

   "attributes":{

      "label":"",

      "description":"",

      "madeBy":"",

      "notes":"",

      "copyright":"<div class=\"copyrightIframe\">  © OpenStreetMap
Contributors;</div> ",

      "madeIn":"",

      "mmVersion":"",

      "datasource":[

         {

            "table":{

               "data":[



               ],

               "columns":[



               ]

            },

            "displayName1":"",

            "displayName2":"",

            "displayName3":"",

            "isParcel":0,

            "isMap":1,

            "map":{

               "dpi":"96",

               "rotation":0,

               "center":[

                  1960176.3323157998,

                  6168869.777743851

               ],

               "scale":7000,

               "layers":[

                  {

                     "type":"osm",

                     "baseURL":"
http://tile.openstreetmap.org/{z}/{x}/{y}.png";,

                     "opacity":1,

                     "maxExtent":[

                        -20037508.342789244,

                        -20037508.342789244,

                        20037508.342789244,

                        20037508.342789244

                     ],

                     "tileSize":[

                        256,

                        256

                     ],

                     "resolutions":[

                        156543.03390625,

                        78271.516953125,

                        39135.7584765625,

                        19567.87923828125,

                        9783.939619140625,

                        4891.9698095703125,

                        2445.9849047851562,

                        1222.9924523925781,

                        611.4962261962891,

                        305.74811309814453,

                        152.87405654907226,

                        76.43702827453613,

                        38.218514137268066,

                        19.109257068634033,

                        9.554628534317017,

                        4.777314267158508,

                        2.388657133579254,

                        1.194328566789627,

                        0.5971642833948135,

                        0.29858214169740677,

                        0.14929107084870338,

                        0.07464553542435169,

                        0.037322767712175846,

                        0.018661383856087923,

                        0.009330691928043961,

                        0.004665345964021981,

                        0.0023326729820109904,

                        0.0011663364910054952,

                        0.0005831682455027476,

                        0.0002915841227513738

                     ],

                     "imageExtension":"png"

                  }

               ]

            }

         }

      ],

      "legendOnPage":0,

      "printParcelInfo":0,

      "iconLeft":"images/logo.png",

      "iconRight":""

   }

}



The scale is set to "scale":7000.

However, after printing pdf on paper, distance is as it was set to scale.
1:5000. I have measured lines on paper and figured out that the scale is
not good at all.

I have tried to solve the problem with attribute “geodetic”: true, as is
recommended on these two pages:

https://gis.stackexchange.com/questions/218015/geoserver-mapfish-print-wrong-scale-and-scalebar-on-my-printed-map

https://gis.stackexchange.com/questions/173678/geoserver-with-printing-plugin-scale-too-low

but, unfortunately with no luck.

In configuration file, my set up for a4 is:

templates:


#===========================================================================

  A4 portrait: !template


#===========================================================================

    reportTemplate: A4Portrait.jrxml

    tableData: jrDataSource

    outputFilename: ${outputFilename}

    attributes:

      iconLeft: !string {}

      iconRight: !string {}

      madeBy: !string {}

      madeIn: !string {}

      mmVersion: !string {}

      label: !string {}

      description: !string {}

      notes: !string {}

      copyright: !string {}

      legendCols: !integer

        default: 3

      datasource: !datasource

        attributes:

          table: !table {}

          isParcel: !integer {}

          isMap: !integer {}

          displayName1: !string {}

          displayName2: !string {}

          displayName3: !string {}

          map: !map

            maxDpi: 450

            dpiSuggestions: [90,96,150,300]

            width: 570

            height: 696

          scalebar: !scalebar

            width: 240

            height: 30

            createSubReport: false

            default:

              barBgColor: rgba(0,0,0,0)

              align: "left"

          northArrowDef: !northArrow

            size: 50

            createSubReport: false

            default:

              graphic: "images/gm-north.png"

      legendOnPage: !integer {}

      printParcelInfo: !integer {}

    processors:

    - !reportBuilder # compile all reports in current directory

      directory: '.'

    - !configureHttpRequests

      httpProcessors:

        - !forwardHeaders

          headers: [Referer, User-Agent, Cookie, Authorization]

        - !addHeaders

          headers:

            User-Agent: ${customUserAgent}

            Referer: ${customReferer}

    - !createDataSource

      reportTemplate: A4PortraitLegend.jrxml

      reportKey: reportTemplate

      processors:

        - !prepareTable {}

        - !createMap {}

        - !createScalebar {}

        - !createNorthArrow

          inputMapper: {map: map, northArrowDef: northArrow}

    tableData: jrDataSource

    outputFilename: ${outputFilename}

    pdfConfig:

      title: test print

      subject: test print



Does anyone have a clue?



Best regards,

Miroslav Hrcan
_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to