How to use MapFish print module for GeoServer-GeoWebCache layer? - printing

I am in the process of developing a webGIS application using GeoServer (2.1.1), GeoWebCache(1.2.6), OpenLayers(2.11), GeoExt. All my layers are served as wms through GeoWebCache. A sample definition for any layer is as follows:
var My_Layer = new OpenLayers.Layer.WMS( "My_Layer",
"http://my-ip + my-port/geoserver/gwc/service/wms",
{layers: 'layer-name',transparent: "true",format: "image/png",
tileSize: new OpenLayers.Size(256,256),
tilesOrigin : map.maxExtent.left + ',' + map.maxExtent.bottom },
{ isBaseLayer: false, visibility:false} );
Everything was working fine, till this point. But, when I planned to move a bit ahead and tried implementing MapFish Printing module...... the output pdf is blank!!! I am getting the following error message:
java.io.IOException: Error (status=400) while reading the image
from........
I have searched a lot. According to this one option is to access my layers as TMS layer. But I don't want a static image layer, instead of a GeoServer WMS map layer.
Again another option found here is using OpenLayers.Control.ExportMap().
But that restricts using different scales, since my data extent is too big . As a result at a specific scale if user wants to take a print of the entire map area(may be in an A0 paper), which is not visible fully in the Openlayers div, this can not solve the purpose.
So the question is how can I accomplish this, without using a TMS or GeoWebCache layer?
Edit # 1 :
Sorry I am late, as I was out of office. Following is my config.yaml file. I feel there is no error, this can print my WMS layers, coming directly from GeoServer.
dpis: [75, 150, 300]
outputFormats:
- pdf
scales:
- 10000
- 25000
- 50000
- 100000
hosts:
- !localMatch
dummy: true
- !ipMatch
ip: www.camptocamp.org
- !dnsMatch
host: labs.metacarta.com
port: 80
- !dnsMatch
host: terraservice.net
port: 80
- !dnsMatch
host: sigma.openplans.org
- !dnsMatch
host: demo.mapfish.org
layouts:
A4 portrait:
metaData:
title: 'Arunava TopoMap PDF'
author: 'Arunava print module'
subject: 'Map layout'
keywords: 'map,print'
creator: 'Arunava'
mainPage:
pageSize: A4
rotation: true
items:
- !text
text: '${mapTitle} ${now MM.dd.yyyy}'
fontSize: 20
spacingAfter: 30
- !map
spacingAfter: 30
width: 440
height: 600
- !scalebar
type: bar
maxSize: 100
barBgColor: white
fontSize: 8
align: right
- !text
font: Helvetica
fontSize: 9
align: right
text: '1:${scale}'
footer: *commonFooter
A2 portrait:
metaData:
title: 'Arunava TopoMap PDF'
author: 'Arunava print module'
subject: 'Map layout'
keywords: 'map,print'
creator: 'Arunava'
mainPage:
pageSize: A2
rotation: true
items:
- !text
text: '${mapTitle} ${now MM.dd.yyyy}'
fontSize: 20
spacingAfter: 30
- !map
spacingAfter: 30
width: 880
height: 1200
- !scalebar
type: bar
maxSize: 100
barBgColor: white
fontSize: 8
align: right
- !text
font: Helvetica
fontSize: 9
align: right
text: '1:${scale}'
footer: *commonFooter

Without further debugging, the 400 error is too vague for much help. From experience, I can tell you I've seen an issue before where the geowebcache server doesn't like serving the wms layer you are requesting. Mapfish tries to do weird things with different tile sizes (and you eventually get a 10% threshold error). Does your log show the image it was requesting? Can you go to that tile in our browser to see what the server actually says? This is how I eventually exposed my issues.
For easier debugging, I've also created a seperate mapfish log to make it easier to find my mapfish issues. Use the Geoserver admin screen to figure out which logging profile you are using, then in that log4j.properties file, add a seperate file appender for mapfish, and direct all org.mapfish activity to it. This makes debugging much easier.
And FINALLY, my own personal crusade: in your config.yaml, don't use outputFormats: [pdf],
instead, use formats: ['pdf'].
Even though all the docs describe outputFormat (and that's what required in the client "spec"), the actual server config is uses the 'formats' variable. I've submitted a patch to make this more clear in the docs, but until then, let's this note be a guide. If you want to get into the image output, this is key.

Related

HighCharts offline-exporting module not working

I'm having trouble forcing highcharts to export offline. I've added the offline-exporting.js module along with the exporting module. I've set the fallbackToExportServer to false, but I still go to the highcharts server (https://export.highcharts.com/) and get this error: 13 Request Entity Too Large.
<script src="//code.highcharts.com/highcharts.js"></script>
<script src="//code.highcharts.com/modules/data.js"></script>
<script src="//code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/offline-exporting.js"></script>
exporting: {
filename: title,
fallbackToExportServer: false,
To see the issue, go to: https://www.nrel.gov/transportation/drive-cycle-tool/
In the Drive cycles table, search for “Fleet DNA”.
Click on “Fleet DNA Drayage Maximum Energy*”
Scroll up and click “Download Drive Cycle Data or Image” under the chart.
Choose “Download JPEG image”
Some data sets work fine.
It is linked to this reported issue:
https://github.com/highcharts/highcharts/issues/4614
As a workaround you could set up a custom exporting server with increased size limit:
https://www.highcharts.com/docs/export-module/setting-up-the-server
I noticed the same issue few days back, kind of strange, despite setting the flag to false, it was calling the highchart server for chart pdf.
I then resorted to use exportChartLocal method of highchart chart instance:
chart.exportChartLocal({
type: 'image/jpeg', // replace with image/jpeg
filename: 'test.jpg',
fallbackToExportServer: false,
sourceWidth: 900,
scale: 1,
});
Look at this example: https://jsfiddle.net/riteshwaghela/huw8e31z/7/

Highcharts version 8.2.0 tilemap doesn't support "square" shape

I've been using highcharts 7.2.0 tilemap chart, but after updating to version 8.2.0, I'm getting an error when tileShape is set to "square"
In my https://jsfiddle.net/nqxm2yk7/1/ , tileShape is set to 'circle', but if you change it to "square", it will be crash.
Although the official documentation says, that we can use four different types of shapes
Is anyone has the same problem?
[1]: https://jsfiddle.net/nqxm2yk7/1/
If you want square tiles you will need to set the chart type to "heatmap":
chart: {
type: 'heatmap',
height: '120%'
},
and also include heatmap.js
Fiddle
I found that it is a regression and I reported it on the Highcharts Github issue channel where you can follow this thread: https://github.com/highcharts/highcharts/issues/14267. If you need a temporary workaround please ask in the comment for it - the core developers will take care of your case.

Alchemy CMS - Cloudinary - Image crop

In Alchemy CMS how can I use the Cloudinary feature for get the image in the size that I want?
I need this for:
a specific image, I mean that, one image could be 400x300 and another could be 200x200
for all the images of the same element
How can I do it?
In the element definition, in elements.yml, I can use the settings property:
- name: content_block
contents:
- name: title_text
type: EssenceText
default: :title_text_sample
- name: picture
type: EssencePicture
settings:
size: 400x300
crop: true
- name: multi_line_text
type: EssenceRichtext
but this is the same for all contents and I think that in this way the resize is done by the Alchemy server and not by the cloudinary.
Is there a way to edit the URLs manually? If so you can change the size of the images on the fly. For example, http://res.cloudinary.com/demo/image/upload/w_200,h_200/sample

VectorTile stops trying to load tiles

I need to host vector tiles on my local machine but I'm not allowed to run a tile server. So I unpacked an mbtiles database filled with pbf files and I'm accessing them directly with the following VectorTile layer.
var layer = new ol.layer.VectorTile({
source: new ol.source.VectorTile({
format: new ol.format.MVT(),
tileGrid: ol.tilegrid.createXYZ({
tileSize: 512,
minZoom: 4,
maxZoom: 18,
}),
tilePixelRatio: 8,
//url: 'http://localhost:2020/foo/bar/{z}/{x}/{y}.pbf'
url: 'file://C:/ProgramData/foo/bar/{z}/{x}/{y}.pbf'
}),
renderMode: 'vector'
});
All is good unless I navigate to a place in the world where tiles don't exist. The VectorTile source stops trying to load more tiles. It won't even try when I navigate back to a place where I know tiles exist.
How can I make the VectorTile source not give up so easily?
UPDATE:
I modified the code snippet to show the two URLs I've been using. Both are using the same data set. The first url is being served by Caddy and everything is great. The second url is the browser accessing the files directly which works great until I go where tiles don't exist.

PhantomJS's limit for PNG generation with an Hightchart JSON document(3DOption enable)

We have this JSON document (Hightcharts chart) with 3D options disabled http://pastebin.com/0rvW3cu3)
The PNG generation with PhantomJS works without any problem.
With the 3D option enabled,the PNG generation do not work anymore
I dont think it's a syntax error, my other documents works with 3D enabled.
There is only one difference between those two documents which is :
3D enabled :
options3d:{enabled: true, alpha: 0, beta: 0, depth: 50}}
3D disabled :
options3d:{enabled:false} (3D disabled)
The document has 48.000 characters
I use PhantomJS as a local server and I use POST requests to communicate with
Is there a maximum size of a JSON document handled by PhantomJS ?
Edit :
I use this format of data to hide 0 value : {y:0, dataLabels:{enabled:false}}
When my first data of my graphics is {y:0, dataLabels:{enabled:false}}, the data graphics is not displayed.
Fiddle example:
if you modify the first data "1" to {y:0, dataLabels:{enabled:false}} the graphic doesn't works
Your data is makes your chart throw error #12
Highcharts expects point configuration to be numbers or arrays in turbo mode
This can be solved by setting turboThreshold to 0 (turn it off).
Example: http://jsfiddle.net/24qvky06/1/
plotOptions: {
series: {
turboThreshold: 0
}
},
API reference for turboThreshold: http://api.highcharts.com/highcharts#plotOptions.series.turboThreshold

Resources