Giter Club home page Giter Club logo

mapfish / mapfish-print Goto Github PK

View Code? Open in Web Editor NEW
183.0 19.0 414.0 247.73 MB

A component of MapFish for printing templated cartographic maps. This module is the Java serverside module.

Home Page: http://mapfish.github.io/mapfish-print-doc/

License: BSD 2-Clause "Simplified" License

Java 79.39% XSLT 0.07% HTML 0.62% Shell 0.26% Scheme 1.55% Batchfile 0.09% Python 0.11% Dockerfile 0.17% Makefile 0.10% CSS 0.20% JavaScript 17.44%
java jasperreports geotools geospatial reporting gis ogc maps geomapfish

mapfish-print's People

Contributors

andreheinecke avatar aruneko avatar aymandf avatar bchapuis avatar c2c-bot-gis-ci avatar cmangeat avatar danduk82 avatar dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar dersteppenwolf avatar didier-coignet-dict avatar dispiste avatar ebelo avatar gberaudo avatar hwbllmnn avatar ismailsunni avatar jenselme avatar jwkaltz avatar marcjansen avatar marionb avatar mlechner avatar nielscharlier avatar pvalsecc avatar renovate-bot avatar renovate[bot] avatar sbrunner avatar sebr72 avatar vampouille avatar vuilleumierc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mapfish-print's Issues

© symbol not rendered from text field

I have the following in my YAML, however the printed map doesn't include the © symbol:
text: "© Crown Copyright"

But if I pass it through form a variable (so
Javascript:
mapComment = "© Crown Copyright"

YAML:
text: {$mapComment}

That works fine.

Obscure error stacktrace when posting to create.json

When I post to create.json (in geoserver-print module) I get an obscure error that doesn't give any insight to what is wrong. Is it possible to enhance the error handling to provide more valuable information?

Sample: http://dbk.mapcache.nl/print-fail.html

{
    "units": "m",
    "srs": "EPSG:28992",
    "layout": "A4 portrait",
    "dpi": 75,
    "layers": [
        {
            "type": "TMS",
            "baseURL": "http://openbasiskaart.nl/mapcache/tms/",
            "opacity": 1,
            "singleTile": false,
            "maxExtent": [
                -285401.92,
                22598.08,
                595401.92,
                903401.92
            ],
            "tileSize": [
                256,
                256
            ],
            "format": "png",
            "extension": "png",
            "layer": "osm-nb@rd",
            "resolutions": [
                3440.64,
                1720.32,
                860.16,
                430.08,
                215.04,
                107.52,
                53.76,
                26.88,
                13.44,
                6.72,
                3.36,
                1.68,
                0.84,
                0.42,
                0.21
            ],
            "styles": [
                ""
            ]
        }
    ],
    "pages": [
        {
            "center": [
                54117.000091572,
                392313.99977642
            ],
            "scale": 4000000,
            "rotation": -62,
            "mapTitle": "dbk viewer print test",
            "comment": "Dit is de print test van de dbk viewer"
        }
    ]
}

I get the following error. I haven't changed anything in my config.yaml except add openbasiskaart.nl to the hosts.

Error while generating PDF:
DocumentException: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    at java.lang.String.substring(Unknown Source)
    at org.mapfish.print.map.readers.TmsMapReader.<init>(TmsMapReader.java:48)
    at org.mapfish.print.map.readers.TmsMapReader.create(TmsMapReader.java:86)
    at org.mapfish.print.map.readers.MapReader.create(MapReader.java:58)
    at org.mapfish.print.map.MapChunkDrawer.renderImpl(MapChunkDrawer.java:98)
    at org.mapfish.print.ChunkDrawer.render(ChunkDrawer.java:55)
    at org.mapfish.print.ChunkDrawer.tableLayout(ChunkDrawer.java:49)
    at com.lowagie.text.pdf.PdfPTable.writeSelectedRows(Unknown Source)
    at com.lowagie.text.pdf.PdfPTable.writeSelectedRows(Unknown Source)
    at com.lowagie.text.pdf.ColumnText.goComposite(Unknown Source)
    at com.lowagie.text.pdf.ColumnText.go(Unknown Source)
    at com.lowagie.text.pdf.ColumnText.go(Unknown Source)
    at com.lowagie.text.pdf.PdfPRow.writeCells(Unknown Source)
    at com.lowagie.text.pdf.PdfPTable.writeSelectedRows(Unknown Source)
    at com.lowagie.text.pdf.PdfPTable.writeSelectedRows(Unknown Source)
    at com.lowagie.text.pdf.PdfPTable.writeSelectedRows(Unknown Source)
    at com.lowagie.text.pdf.ColumnText.goComposite(Unknown Source)
    at com.lowagie.text.pdf.ColumnText.go(Unknown Source)
    at com.lowagie.text.pdf.ColumnText.go(Unknown Source)
    at com.lowagie.text.pdf.PdfDocument.addPTable(Unknown Source)
    at com.lowagie.text.pdf.PdfDocument.add(Unknown Source)
    at com.lowagie.text.Document.add(Unknown Source)
    at org.mapfish.print.config.layout.Page$1.add(Page.java:67)
    at org.mapfish.print.config.layout.MapBlock.render(MapBlock.java:66)
    at org.mapfish.print.config.layout.Page.render(Page.java:65)
    at org.mapfish.print.config.layout.MainPage.render(MainPage.java:62)
    at org.mapfish.print.config.layout.Layout.render(Layout.java:59)
    at org.mapfish.print.MapPrinter.print(MapPrinter.java:144)
    at org.mapfish.print.servlet.MapPrinterServlet.doCreatePDFFile(MapPrinterServlet.java:275)
    at org.mapfish.print.servlet.MapPrinterServlet.createPDF(MapPrinterServlet.java:148)
    at org.mapfish.print.servlet.MapPrinterServlet.doPost(MapPrinterServlet.java:81)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.springframework.web.servlet.mvc.ServletWrappingController.handleRequestInternal(ServletWrappingController.java:159)
    at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
    at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.geoserver.filters.ThreadLocalsCleanupFilter.doFilter(ThreadLocalsCleanupFilter.java:27)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.geoserver.filters.SpringDelegatingFilter$Chain.doFilter(SpringDelegatingFilter.java:74)
    at org.geoserver.filters.SpringDelegatingFilter.doFilter(SpringDelegatingFilter.java:45)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.geoserver.platform.AdvancedDispatchFilter.doFilter(AdvancedDispatchFilter.java:49)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.vfny.geoserver.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:109)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)
    at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:68)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
    at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:72)
    at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
    at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:68)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
    at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:72)
    at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
    at org.geoserver.security.filter.GeoServerAnonymousAuthenticationFilter.doFilter(GeoServerAnonymousAuthenticationFilter.java:53)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
    at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:68)
    at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150)
    at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:72)
    at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)
    at org.geoserver.security.filter.GeoServerBasicAuthenticationFilter.doFilter(GeoServerBasicAuthenticationFilter.java:82)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
    at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:68)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
    at org.geoserver.security.filter.GeoServerSecurityContextPersistenceFilter$1.doFilter(GeoServerSecurityContextPersistenceFilter.java:52)
    at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:72)
    at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:173)
    at org.geoserver.security.GeoServerSecurityFilterChainProxy.doFilter(GeoServerSecurityFilterChainProxy.java:134)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.geoserver.filters.LoggingFilter.doFilter(LoggingFilter.java:75)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.geoserver.filters.GZIPFilter.doFilter(GZIPFilter.java:42)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.geoserver.filters.SessionDebugFilter.doFilter(SessionDebugFilter.java:47)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)

    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1805)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

failing to print UTF-8 text

I am trying to print Greek text in MapFish demo application deployed in OSGeoLive 6.5 without success so far:

I have managed to compile and install mapfish-print from git tag "1.2.0" and I replaced the older print module in OSGeoLive tomcat6 folder.
Then I replaced the default config.yaml with the one needed for the application to work:
http://www.mapfish.org/svn/mapfish/sample/trunk/print/config.yaml.in
No problem, everything worked as expected and I was able to print the demo map with the updated print module.

Then I made some changes in the config.yaml:
http://pastebin.com/XVW7ikb2
after reading the older reports in:
https://trac.mapfish.org/trac/mapfish/ticket/199
http://old.nabble.com/localized-strings-in-PDF-print-module-td18718536.html

Initially I added a font definition pointing to FreeSans.ttf
That did not cause any problem.
Then I tried to print Greek characters as in line 78 of http://pastebin.com/XVW7ikb2
I enabled line 75:

fontEncoding: Identity-H

and the application crashes.

Error log from tomcat6:
http://pastebin.com/B4W1y1cj

Catalina.out:
http://pastebin.com/rAhPd20t

http://localhost:8080/print-mapfishsample-osgeolive/pdf/info.json result:
javax.servlet.ServletException: Error occurred while reading configuration file '/var/lib/tomcat6/webapps/print-mapfishsample-osgeolive/config.yaml': org.ho.yaml.exception.YamlException: Error near line 0: End of document expected.
org.mapfish.print.servlet.BaseMapServlet.getMapPrinter(BaseMapServlet.java:164)
org.mapfish.print.servlet.MapPrinterServlet.getInfo(MapPrinterServlet.java:243)
org.mapfish.print.servlet.MapPrinterServlet.doGet(MapPrinterServlet.java:87)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

Is this expected?
Any help would be much appreciated!

proposal: new `include` keyword in config.yaml

A config.yaml file generally contains various layouts (eg. A4/A3/Letter, both portrait and landscape). Their structure is quite similar, and a change in one layout is generally reported in all other layouts, possibly with scale adaptation.

I think it would be easier to manage a set of layouts if each of them was defined in its own file, and then included in the config.yaml using a new keyword; such as include: A4_landscape.yaml for example.

This would allow easier management for a set of layouts, as we could copy, diff, merge them easily.

The new keyword should obviously not be restricted to layouts, but should allow inclusion of any yaml configuration subfile.

Possibly neglected icons property

In the print request, is it possible to submit icons for classes?

I found this line:
final PJsonArray icons = node.optJSONArray("icons");
which seems to indicate that this is the case.

Please let me know an example if you need this feature to work again.

MFP fails to print if legend is enabled but empty.

If I set the displaying of a legend to be true, but there is no content for the legend (because the map only consists of basemap layers), MFP bugs out of printing with this error:

2013-04-17 12:11:02,491 ERROR [org.mapfish.print.servlet.BaseMapServlet] - Error while generating PDF
DocumentException:
ExceptionConverter:
java.io.IOException: The document has no pages.
at com.lowagie.text.pdf.PdfPages.writePageTree(Unknown Source)
at com.lowagie.text.pdf.PdfWriter.close(Unknown Source)
at com.lowagie.text.pdf.PdfDocument.close(Unknown Source)
at com.lowagie.text.Document.close(Unknown Source)
at org.mapfish.print.config.layout.LegendsBlock$Renderer.cleanup(LegendsBlock.java:320)
at org.mapfish.print.config.layout.LegendsBlock$Renderer.render(LegendsBlock.java:241)
at org.mapfish.print.config.layout.LegendsBlock.render(LegendsBlock.java:98)
at org.mapfish.print.PDFUtils.createCell(PDFUtils.java:536)
at org.mapfish.print.PDFUtils.buildTable(PDFUtils.java:521)
at org.mapfish.print.config.layout.ColumnsBlock$1.render(ColumnsBlock.java:58)
at org.mapfish.print.PDFCustomBlocks.addAbsoluteDrawer(PDFCustomBlocks.java:183)
at org.mapfish.print.config.layout.ColumnsBlock.render(ColumnsBlock.java:56)
at org.mapfish.print.config.layout.Page.render(Page.java:73)
...

The exact same map printed without the legend works fine. I'm using the " condition: legends" to enable/disable showing of the legend.

using the snapshot from https://oss.sonatype.org/content/repositories/snapshots/org/mapfish/print/print-servlet/2.0-SNAPSHOT/

Gradle Debug Task

Just trying to debug with Netbeans reveals that there is no debug task that it tries to execute. If no one else, I will look up the documentation for Gradle on how to do this and implement it so that people using Netbeans have an easier time improving the print module.

Wrapping problem with long labels in the new legend system

Hello

I have heard that a lot of changes have been done to the legend block.
In a project using a very recent version of mapfish-print we have noticed that long labels no more wrap on a new line, shifting the legend block to the left, outside of the map. It's OK with short labels or with the old version of the print.

Here are a few screenshots illustrating the problem.
Thanks for your help!

Incorrect displaying of a long label with a recent version of mapfish-print:
new_legend_long_label

The same long label with the old system:
old_legend_long_label

Still OK with short labels:
new_legend_short_label

Unit/functional tests for multiple application contexts i.e. *.yaml

This relates to issue 25. That issue only came about because there were no tests implemented in the master version (and also not in my local version). This is mostly my fault for not doing it, but I'm recording the issue here so it doesn't get forgotten.

So, say there are two applications with two yaml files for their configuration, app-a.yaml and app-b.yaml. We need to create some more generic yaml files that have two different configurations. Suggest we use the ones already there for vector and so on and then assert that the resulting PDFs are different. This will need to include at least 3 tests, loading app-a first, then app-b and then app-a again because that was the bug.

I might get around to doing this at some stage, hopefully this year, but if not, please don't forget this.

Legend: Widows and Orphans problem

When printing a legend with items that are higher than the maxHeight, the next legend items are orphaned. This means that they wrap onto the next column. You can have a situation where the legend class items look like they have no parent and the parent appears to have no children potentially.

This problem is called widows and orphans.

I have improved the code for this in my fork and will contribute it back when I've done some more testing, but I wanted to log the issue so that I can link the commit to it.

Project doesn't build

Using gradle, this project does not build at the moment. I checked out the newest version with git and it did not build. Confirmed by checking out a fresh copy and checking my old version which built successfully.

Could you please ensure the project builds when applying a pull request?

feature proposal : Add halo for labels

Hi,

I'm currently using mapfish print with vector layer. All works well, Thank you very much for your work.

I saw that OpenLayers allow setting halo for text label, with labelOutline properties, but theses properties doesn't work in mapfish print. Have you planned to include labelOutline properties support ?

Thanks in advance,

David

Multiple Applications logic is broken

When printing with different application contexts, the print module behaves wrongly:

Say one has app-a.yaml and app-b.yaml. When printing app-a it works correctly. Then printing app-b also works correctly. However, when then again printing app-a it prints according to app-b. This is because, using Spring DI, there is only one MapPrinter object/bean in the application's context. Not sure why it prints correctly the first time around.

However, I fixed this in my local version by getting the beans from the application context, but not the MapPrinter bean.

Source code and fix to come. I will need to merge it into trunk of make a pull request.

upgrade com.lowagie to com.itextpdf

I succesfully upgraded com.lowagie to com.itextpdf in my fork. Opening an issue here so I have a reminder to port my changes to official.

Since my fork is a bit off by now, I will create a new fork, "slow merge" my changes and then create a pull-request containing purely stuff that is related to upgrading this particular library.

Word Wrap is over-zealous

As you can see in the screencap, word-wrap is over-zealous. Even though my legend is set to a max width of 500, as is the containing column, its still wrapped "Subregion boundary" onto two lines.

clipboard04

I don't think there's anything in my YAML saying to do that, but just in case, it's here:

    #Legend
    - !columns
      #This line determines if the legend is shown in the template.
      condition: legends
      absoluteX: 37
      absoluteY: 560
      width: 150
      config:
        borderWidth: 1
        cells:
          - borderWidth: 1
            borderColor: #555555
            padding: 5

      items:
        - !legends
          iconMaxWidth: 9
          iconMaxHeight: 9
          maxWidth: 150
          #Padding between layers
          layerSpace: 5
          layerFont: Helvetica
          layerFontSize: 9
          #Padding between text and icon within layer
          classSpace: 2
          classIndentation: 5
          classFont: Helvetica
          classFontSize: 9
          backgroundColor: white
          inline:true

Using MFP 1.2

Map has unconfigurable 20 pixel margin around all sides

To reproduce:
Define in my config.yaml a custom layout of size 401x401. Within this layout, create a single block (a map), defining a width and height of 400. Generate a map in pdf format as normal. Generated pdf, instead of a single map, contains an error message "Error: Infinite table loop."

Change config.yaml layout configuration to have a custom size of 440x440. Map and pdf are created correctly (reviewing via an image editor, it shows the map is in fact only 400x400. It seems like all maps have a 20px margin.

Can this margin be configured? I'd love to create a single image of my map without a 20 pixel white border around it. My first investigation couldn't determine the source of this margin, but I'll search further throughout the code.

Empty BMP image created

I'm trying to create a map in BMP format. The result is empty (0 bytes). PNG and PDF both work.

Using the 2.0 build from 19th December 2013.

You can see the DEBUG level log here, which includes the request etc:
http://pastebin.com/1Gas76N1

2 tests failing on Oracle JDK 1.7

Hello, there's 2 tests failing in gradlew build with Oracle JDK 1.7.:
org.mapfish.print.map.readers.MapReaderFactoryFinderTest > test FAILED
org.springframework.beans.factory.BeanDefinitionStoreException at MapReaderFactoryFinderTest.java:13
Caused by: java.io.FileNotFoundException at MapReaderFactoryFinderTest.java:13

org.mapfish.print.config.ConfigTest > testParse FAILED
org.springframework.beans.factory.BeanDefinitionStoreException at ConfigTest.java:37
Caused by: java.io.FileNotFoundException at ConfigTest.java:37

Both are same:

org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [spring-application-context.xml]; nested exception is java.io.FileNotFoundException: class path resource [spring-application-context.xml] cannot be opened because it does not exist" type="org.springframework.beans.factory.BeanDefinitionStoreException">org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [spring-application-context.xml]; nested exception is java.io.FileNotFoundException: class path resource [spring-application-context.xml] cannot be opened because it does not exist

Legend shows items with no GetLegend response

A subjective one.

I have a layer enabled on my map that's not visible because it has a scale threshold and I'm outside that range.

However, when I print the map, MFP 2.0 shows the legend item below (Bus Stops):

clipboard02

What I think it should do is see that the GetLegend response doesn't actually include a graphic and then omit the legend item entirely.

iconMaxHeight not infinite by default

The documentation says that the legend parameters "iconMaxWidth" and "iconMaxHeight" both have "infinite" as their value if they're left blank.

However, if I don't declare iconMaxHeight, MFP shrinks my legend to about 9 pixels.

iconMaxWidth seems to be fine.

Error while generating PDF when legend image points to a 404

The following print spec references a legend image URL which does not exist:
http://pastebin.com/sei0VrvK

Print fails with this message:

Error while generating PDF:
org.mapfish.print.InvalidValueException: url has an invalid value: http://gpp3-wxs.ign.fr/static/LEGENDES/NOLEGEND.JPG
at org.mapfish.print.PDFUtils.createImage(PDFUtils.java:582)
at org.mapfish.print.PDFUtils.createImageChunk(PDFUtils.java:570)
at org.mapfish.print.config.layout.LegendsBlock$Renderer.createImageChunk(LegendsBlock.java:288)
at org.mapfish.print.config.layout.LegendsBlock$Renderer.createTableLine(LegendsBlock.java:408)
at org.mapfish.print.config.layout.LegendsBlock$Renderer.createLegend(LegendsBlock.java:374)
at org.mapfish.print.config.layout.LegendsBlock$Renderer.render(LegendsBlock.java:173)
at org.mapfish.print.config.layout.LegendsBlock.render(LegendsBlock.java:99)

Note that the French IGN GeoPortail is the culprit, since its WMTS capabilities references this URL. Would be better though if the print module could work around the inexistent image.

Custom Maximum Icon Dimensions

We've got a legend icon that needs to be bigger than all the others. This could be achieved by sending a width/height for the legend together with the print request or better with over-ridable settings that are set within the YAML file. The second approach would allow the person configuring the module to have more control over the parameters.

Feedback whether this is sensible would be much appreciated. If no one picks this up in the next few weeks, I think I will do this unless someone raises concerns.

Improve legend icons resolution for GeoServer WMS

By default, icons in the legend use a low resolution.

GeoServer provides a vendor parameter to select the resolution (http://docs.geoserver.org/latest/en/user/services/wms/get_legend_graphic/legendgraphic.html#controlling-legend-appearance-with-legend-options). For example, add the &LEGEND_OPTIONS=dpi:254; parameter at the end of a GetLegendGraphic request to get 254 dpi resolution for the icons.

For example:

image_lowres

image_hires

Would that make sense to add a parameter in the yaml file for icon resolution ?

MFP requesting wrong zoom level for TMS.

I am making the following request (this is to our live external system, so should work for you too):

{"units":"m","srs":"EPSG:27700","layout":"A4 Portrait","dpi":300,"mapTitle":"Printed with Compass","mapComment":"","mapFooter":"","layers":[{"baseURL":"http://maps.warwickshire.gov.uk/gs/gwc/service/tms/","opacity":0.7,"singleTile":false,"type":"TMS","layer":"z_OS_Raster_Basemap","maxExtent":[0,0,700000,1300000],"tileSize":[256,256],"resolutions":[2800,1400,700,350,175,84,42,21,11.2,5.6,2.8,1.4,0.7,0.35,0.14,0.07],"format":"png"}],"pages":[{"center":[430552.3,265431.9],"scale":75000,"rotation":0}]}

However, while the map size is correct, the TMS tiles requested are the wrong scale. MFP is requests tiles at zoom level 9 (which is 1:20,000). It is supposed to be requesting tiles at zoom level 7 (1:75,000).

Prior to the fix in issue 68, it was requesting the correct zoom level.

You can use the application at: http://maps.warwickshire.gov.uk/inspire/ (change the basemap to "Ordnance Survey - Rasters") to see what the map style is supposed to be like at each zoom level - they're very different (1:75,000 is a bright garish affair, 1:20k is a washed out thing).

Legend Block - Base Font

When printing a legend a base font like Arial causes an exception to be thrown. Can be reproduced by putting something like the following into config.yaml:

lastPage:
  pageSize: A4
  items:
    - !columns
      absoluteX: 80
      absoluteY: 745
      width: 450
      items:
        - !text
          align: left
          font: Arial
          fontSize: 16
          text: 'Legend'
    - !columns
      absoluteX: 80
      absoluteY: 715
      width: 450
      items:
        - !legends
          backgroundColor: #FFFFFF
          maxIconWidth: 20
          maxIconHeight: 20
          classIndentation: 0
          layerSpace: 25
          classSpace: 10
          layerFont: Arial
          layerFontSize: 14
          classFont: Arial
          classFontSize: 12
          fontEncoding: Cp1252

I have a fix for this issue and will make a pull request for someone else to review.

MFP 2 requests/shows wrong TMS tiles

See attached. MFP seems to be showing the wrong tiles.

I've never seen this client side which is calling the same GeoServer, so I'm fairly sure GeoServer isn't the problem.

The request sent to MFP is:

{"units":"m","srs":"EPSG:27700","layout":"A4 Portrait","dpi":300,"mapTitle":"Printed with Compass","mapComment":"","mapFooter":"","layers":[{"baseURL":"http://compass:8082/geoserver/gwc/service/tms/","opacity":0.7,"singleTile":false,"type":"TMS","layer":"Warks_Full","maxExtent":[0,0,700000,1300000],"tileSize":[256,256],"resolutions":[2800,1400,700,350,175,84,42,21,11.2,5.6,2.8,1.4,0.7,0.35,0.14,0.07],"format":"png"}],"pages":[{"center":[430552.3,265431.9],"scale":75000,"rotation":0}]}

clipboard01

Remove "content-disposition" header

As best I can tell, currently when MFP serves a request it includes a header that looks like this:

"Content-disposition:attachment; filename=COMPASS-2013-06-21T105028.pdf"

What this does is force the browser to show a "save/open" dialog. The problem is these days almost all web-browsers come with an integrated PDF viewer, so saving the file is superfluous to most of our users.

It would be good if this could be removed, or ideally set as a system-wide YAML option (like outputFilename is).

Spring dependency introduced a breaking regression

As discussed here: http://osgeo-org.1560.n6.nabble.com/info-json-java-lang-NullPointerException-td5019963.html

Unfortunately the only version available in the maven repo is 1.2-SNAPSHOT which has now regressed since the introduction of spring dependency. I'm sure I'm not the only one that have multiple older projects depending on 1.2-SNAPSHOT which are now broken. Of course I shouldn't have depended on a snapshot and expected it to continue to work but there is no stable version available and mapfish print is too good to ignore :)

I suggest branching fe62ee6 rename and tag as stable 1.2 pushing that to the official maven repo and then rebrand the current master to 2.0-SNAPSHOT.

Vector layer with geojson causes NullPointerException in org.mapfish.print.map.renderers.vector.PointRenderer

Creating map images in the pdf when I only use a WMS layer for base tiles is completely fine. Works as expected. However, when I add a vector layer and a geoJSON object within it, mapfish print throws the following error:

(I am using a war in tomcat built from a zipped download of the repo on 16th of July 2013, versioned as 2.0-SNAPSHOT)

Exception in thread "tilesReader3" java.lang.NullPointerException
    at org.mapfish.print.map.renderers.vector.PointRenderer.renderImpl(PointRenderer.java:113)
    at org.mapfish.print.map.renderers.vector.PointRenderer.renderImpl(PointRenderer.java:49)
    at org.mapfish.print.map.renderers.vector.GeometriesRenderer.render(GeometriesRenderer.java:69)
    at org.mapfish.print.map.renderers.vector.FeaturesRenderer$FeatureRenderer.renderImpl(FeaturesRenderer.java:62)
    at org.mapfish.print.map.renderers.vector.FeaturesRenderer$FeatureRenderer.renderImpl(FeaturesRenderer.java:58)
    at org.mapfish.print.map.renderers.vector.FeaturesRenderer.render(FeaturesRenderer.java:53)
    at org.mapfish.print.map.renderers.vector.FeaturesRenderer$FeatureCollectionRenderer.renderImpl(FeaturesRenderer.java:70)
    at org.mapfish.print.map.renderers.vector.FeaturesRenderer$FeatureCollectionRenderer.renderImpl(FeaturesRenderer.java:67)
    at org.mapfish.print.map.renderers.vector.FeaturesRenderer.render(FeaturesRenderer.java:53)
    at org.mapfish.print.map.readers.VectorMapReader$1.renderOnPdf(VectorMapReader.java:85)
    at org.mapfish.print.map.ParallelMapTileLoader.handle(ParallelMapTileLoader.java:97)
    at org.mapfish.print.map.ParallelMapTileLoader.handle(ParallelMapTileLoader.java:41)
    at org.pvalsecc.concurrent.OrderedResultsExecutor.addOutput(OrderedResultsExecutor.java:148)
    at org.pvalsecc.concurrent.OrderedResultsExecutor.access$600(OrderedResultsExecutor.java:23)
    at org.pvalsecc.concurrent.OrderedResultsExecutor$Runner.run(OrderedResultsExecutor.java:181)
    at java.lang.Thread.run(Unknown Source)

My query that I am sending to Mapfish print is a slightly modified version of the default sample (to use a different WMS as the default for the example seems down), with the Vector layer added in, as follows:

(This is sent via the GET request, but POSTing throws the exact same error and hence does not return anything either, the geoJSON also checks out on geojsonlint.com

Removing the Vector layer causes the maps to render fine, displaying a map centred on London, and another zoomed in)

{
         layout: 'A4 portrait',
         title: 'A simple example',
         srs: 'EPSG:4326',
         units: 'dd',
         outputFilename: 'mapfish-print',
         outputFormat: 'pdf',
         layers: [
             {
                 type: 'WMS',
                 format: 'image/png',
                 layers: ['OSM-GB:__all__'],
                 baseURL: 'http://www.osmgb.org.uk/ogc/wms'
             },
             {
                 type: 'Vector',
                 geoJson: {
                    "type": "FeatureCollection",
                    "features": [
                        {
                            "type": "Feature",
                            "geometry": {
                                "type": "Point",
                                "coordinates": [
                                    -0.0996621,
                                    51.5059247
                                ]
                            },
                            "properties": {
                            }
                        },
                        {
                            "type": "Feature",
                            "geometry": {
                                "type": "Point",
                                "coordinates": [
                                    -0.099332,
                                    51.5072000
                                ]
                            },
                            "properties": {
                            }
                        },
                        {
                            "type": "Feature",
                            "geometry": {
                                "type": "Point",
                                "coordinates": [
                                    -0.0945508,
                                    51.50240484
                                ]
                            },
                            "properties": {
                            }
                        }
                    ]
                }
             }
         ],
         pages: [
             {
                 center: [0.09, 51.50],
                 scale: 4000000,
                 dpi: 190,
                 mapTitle: "First map",
                 comment: "The \"routes\" layer is not shown (the scale is too small)",
                 data: [
                     {id:1, name: 'blah', icon: 'icon_pan'},
                     {id:2, name: 'blip', icon: 'icon_zoomin'}
                 ]
             },
             {
                 center: [0.09, 51.50],
                 scale: 500000,
                 dpi: 190,
                 mapTitle: "Second map",
                 comment: "This is a zoomed in version of the first map. Since the scale is more appropriate, we show the \"routes\" layer.",
                 data: [
                     {id:1, name: 'blah', icon: 'icon_pan'},
                     {id:2, name: 'blip', icon: 'icon_zoomin'}
                 ]
             }
         ]
      }

Having looked through the source I cannot figure out why exactly this is occurring. Though it seems to be something to do with styles, I have had no luck adding one into the request to fix this issue.

Add configuration option for base url

On occasion the url or port of the web server containing mapfish-print is not the server that is public to the internet and the requests are proxied to the mapfish-print webserver. In this case it is important for the info.json request to return the public URL instead of the url of the webserver.

A parameter (proxyBaseUrl) in the config.yaml can be added to specify the URL to write to the info.json.

MapFish doesn't render HTML legend titles properly

I have a SLD with a definition of:

se:NameA&E Hospitals/se:Name se:FeatureTypeStyle se:Rule se:PointSymbolizer se:Graphic se:ExternalGraphic se:Formatimage/png/se:Format /se:ExternalGraphic se:Size26/se:Size /se:Graphic /se:PointSymbolizer /se:Rule /se:FeatureTypeStyle

Because it's XML, it needs to have the & down as & (as I've done here). MFP 2.0 doesn't seem to realise this and renders it as & rather than &.

java.lang.NullPointerException

Running the "print-servlet-2.0-SNAPSHOT" on Tomcat 7 for Windows;

I'm getting the following error while executing the sample code "http://localhost:8080/print-servlet-2.0-SNAPSHOT/"

Can someone help me at least identify the cause of the error or guide me for the right configuration.

Thanks;

Error while generating PDF:
java.lang.NullPointerException
    at org.mapfish.print.servlet.MapPrinterServlet.doCreatePDFFile(MapPrinterServlet.java:315)
    at org.mapfish.print.servlet.MapPrinterServlet.createAndGetPDF(MapPrinterServlet.java:155)
    at org.mapfish.print.servlet.MapPrinterServlet.doGet(MapPrinterServlet.java:86)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

Legends Print on new line - and other issues

When printing legends and setting inline: true to give a maxHeight of the legend, so that legends are printed on a new column if they overflow, the legend chips are printed on the next line. In fact, as far as I remember, the new line problem also happens when inline: false is set.

If you need more info to reproduce, I can provide that when I have a bit more time.

feature proposal : do not add overviewLayers if empty array

Currently, if you specify an empty array in the spec for the 'overviewLayers' key, the red box used by the overview is rendered, but without any layers (obviously). Would it make more sense not to draw a map block that uses the 'overviewMap' property if no overview layers are sent ? That way, it would become optional to include an overview map using a single page definition. Also, for me it would be perfect because it would avoid drawing the red box when not needed.

MF Print doesn't do legend for categorised items properly

When printing a layer that has been categorised, MapFish fails to create a proper legend for that item. See:

Clipboard01

The small vertical line under "property boundaries - subregional" is actually a key showing the different categorisations and their symbology. (this was a PDF, converted to PNG to let me upload here)

Looking at the GeoServer request log and its response, GeoServer is correctly serving the Legend item (see other attached). But when its placed into the PDF, its shrinking it massively. This is what GeoServer returns:
geoserver-GetLegendGraphic image

MapFish Print legend YAML:

        - !legends
          font: Helvetica
          maxIconWidth: 8
          maxIconHeight: 8
          layerSpace: 5
          layerFontSize: 10
          classIndentation: 10
          classFontSize: 10
          classSpace: 3
          backgroundColor: white
          inline:false

Using a snapshot of 1.2 from about a month or two ago that someone else built.

Inconsistent use of the extension/format property

XYZ layers call the property "extension."

TMS layers call the property "format."

Seems like we should standardize on 1 of these.

I would suggest standardizing on "extension." To me, format should be something like "image/png", while extension would just be "png." As the code currently operates, it's just looking for "png."

Mapfish releaseplanning

Is there any releaseplan available on mapfish? The last real release seems to be 1.2.0 which dates back two years and I would like to know if and when a new release that fixes some minor issues is planned.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.