Building simple clients for MapFish — cURL as a client

I have two previous posts on using MapFish (in this case, the GeoServer version) to allow for printing to hi-resolution PDF maps from the browser.  Here we use a command-line browser (cURL) to post our json to the MapFish service in order to retrieve our PDF.

I did not keep any notes from before on making json posts to the MapFish server as a means by which to test any manual configuration of the json file, so I had to rediscover this approach from pages like this.

The “@” sign below is so that curl knows I’m feeding it a file instead of the actual json to post:

curl -i -H "Accept: application/json" -H "Content-Type: application/json" -X POST --data @mapfish_landscape.json http://localhost:8080/geoserver/pdf/create.json

3 thoughts on “Building simple clients for MapFish — cURL as a client

  1. Hey, lots of good resources here. Thanks. Do you have an advice for getting preparing bounding box coordinates from leaflet into GeoFish’s print module. Not having much luck.Server is up and running,but unable to pass latlong bounds in to get my output.How do i figure out resolution and max extents from a Leaflet bounds?Cant I just pass bbox into the spec and Mapfish will get it right? My example code is below.This throws a missing maxextent and then resolutions errors….Thanks!

    layout: ‘A4 portrait’,
    srs: ‘EPSG:4326’,
    title: ‘ sample’,
    units: ‘degrees’,
    layers: [
    baseURL: ‘’,
    type : ‘Osm’,
    layers: [‘basic’],
    format: ‘image/jpeg’
    pages: [
    bbox: [29.997620298762044, -90.06184101104735, 30.00269348276742, -90.05364418029785,],
    dpi: 190,
    mapTitle: “OSM Map”,
    comment: “This is the first page selected by the user.”

      1. Yes, the config file seems file, as the sample files given proceed through without issue. I’m just having trouble converting my front-end(leaflet side) coordinates to what mapfish print needs. Seems like almost all the examples use M instead of degrees, I guess this is the way to go?I’m trying to prep Proj4 now so I can convert between systems, but having trouble getting the ruby bindings for it working on my system….Anyway, thanks for responding.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.