4

After being able to solve most of my problems just be lurking, I find I now need to come into the light for this one. The headline is pretty explicit. I have been unable to use the mapfish print utility to generate my PDF's including the Bing base layers. For a live example, please visit http://gis.lhtac.org/safety_print . Steps to reproduce follow:

 1.  Select a region.  Click on one of the colored areas.  I suggest district 2.
 2.  Select a Jurisdiction.  A panel will pop with a list of road jurisdictions.  I suggest 'Grangeville'. 
 3.  Please observe the layers, including the Bing base layers, and our in-house WMS layers.  Also, observe the 'Print Map' button is now live in the Crash Statistics panel.
 4.  If desired, drag a bounding box to select some of the indicated crashes. This will select some datapoints for a WFS layer derived from the Crash Location WMS layer data. 
 5.  Click on the 'Print Map' button. 
 6.  Observe the GeoExt print panel, and that the Bing Layers are shown, but possibly only around the edges.
 7.  Zoom in once or twice and observe the Bing layer is now fully represented. 
 8.  Click the 'Create PDF' anchor in the tbox of the print panel.  Wait for a bit while the server thinks about it.  Presuming nothing has broken, a generated pdf will be offered for download.
 9.  Open the pdf, and please observe the following: 

 A: the Bing base layer is missing. 
 B: our in-house WMS layers are shown, although at poor resolution.
 C: If WFS selections had been made, they are shown, with the known filled polygon rendering bug. 
 D: Other artifacts are shown, pretty much as might be expected. 

My best guess as to the cause of no base layer is that there is some unspecified problem using Bing with the Mapfish utility. I have been unable to find any reference to this, however, either as a bug, or as a terms of service issue. The second most likely problem is my config.yaml is incorrectly referencing the Bing servers. That section of the config.yaml follows: (The SE editor has mangled it slightly)

hosts: - !ipMatch ip: 127.0.0.1 port: 8080 - !ipMatch ip: gis.lhtac.org - !ipMatch ip: www.camptocamp.org - !dnsMatch host: maps.live.com port: 80 - !dnsMatch host: virtualearth.com port: 80

Thanks for looking.

  • I suspect not. Google Premium is supported, but you need to specify a key - dev.mapfish.org/sandbox/camptocamp/print-geobi/docs/… - Also of course there may be legal/licensing issues with enabling duplication of Bing Maps. – GIS-Jonathan Jan 6 '14 at 21:09
  • I saw the key parameter for Google, but since there is no mention of Bing, it remains gray for me. And, trying the obvious ( key parameter, and hope it picks up for Bing) didn't work. The potential non-technical issues are a different question. The Bing ToS do not directly prohibit reproduction, but do mention that Bing attributions must be present. Again, a gray area, but I'm focusing on the tech side at the moment. – JustaJoe Jan 6 '14 at 21:26
  • I read time ago in the Openlayers and MapFish mailing lists that it's not possible because licensing issues as explained by @GIS-Jonathan. The only one that works afaik is openstreetmap with the mapfish print. – Gery Jan 7 '14 at 11:52
  • @Gery: If it's convenient, and those list references are public, could you post them for me? I'll then accept that as the answer. If not, please reply back so I can close this out. Thanks – JustaJoe Jan 7 '14 at 15:57
2

Sure, here they go:

  1. https://groups.google.com/forum/#!topic/geoext-users-archive/CuRNR0Bunao
  2. http://lists.mapfish.org/pipermail/users/2009-June/001358.html
  3. http://web.archiveorange.com/archive/v/0qLmXZEGywMbGnqRlv67

However, you can use GMaps v2 API through OpenLayers, and perhaps print it as basemap with MapFish, here it is the source code:

var options = {
    singleTile: true,
    ratio: 1,
    isBaseLayer: true,
    wrapDateLine: true,
    getURL: function() {
        var center = this.map.getCenter().transform("EPSG:3857", "EPSG:4326"),
            size = this.map.getSize();
        return [
            this.url, "&center=", center.lat, ",", center.lon,
            "&zoom=", this.map.getZoom(), "&size=", size.w, "x", size.h
        ].join("");
    }
};

var map = new OpenLayers.Map({
    div: "map",
    projection: "EPSG:3857",
    numZoomLevels: 22,
    layers: [
        new OpenLayers.Layer.Grid(
            "Google Physical",
            "http://maps.googleapis.com/maps/api/staticmap?sensor=false&maptype=terrain", 
            null, options
        ),
        new OpenLayers.Layer.Grid(
            "Google Streets",
            "http://maps.googleapis.com/maps/api/staticmap?sensor=false&maptype=roadmap", 
            null, options
        ),
        new OpenLayers.Layer.Grid(
            "Google Hybrid",
            "http://maps.googleapis.com/maps/api/staticmap?sensor=false&maptype=hybrid", 
            null, options
        ),
        new OpenLayers.Layer.Grid(
            "Google Satellite",
            "http://maps.googleapis.com/maps/api/staticmap?sensor=false&maptype=satellite", 
            null, options
        ),
        // the same layer again, but scaled to allow map sizes up to 1280x1280 pixels
        new OpenLayers.Layer.Grid(
            "Google Satellite (scale=2)",
            "http://maps.googleapis.com/maps/api/staticmap?sensor=false&maptype=satellite&scale=2", 
            null, OpenLayers.Util.applyDefaults({
                getURL: function() {
                    var center = this.map.getCenter().transform("EPSG:3857", "EPSG:4326"),
                        size = this.map.getSize();
                    return [
                        this.url, "&center=", center.lat, ",", center.lon,
                        "&zoom=", (this.map.getZoom() - 1),
                        "&size=", Math.floor(size.w / 2), "x", Math.floor(size.h / 2)
                    ].join("");
                }
            }, options)
        )
    ],
    center: new OpenLayers.LonLat(10.2, 48.9).transform("EPSG:4326", "EPSG:3857"),
    zoom: 5
});
map.addControl(new OpenLayers.Control.LayerSwitcher());

and the OpenLayers example:

http://openlayers.org/dev/examples/google-static.html

Additionally, this nice post may help you if you want to include GMaps + MapServer + TileCache:

http://crschmidt.net/blog/archives/311/using-tilecache-with-google-maps-and-virtual-earth/

  • Thanks! I'd upvote your answer also, but I don't have enough rep, yet. As it happens, I just shifted my base layers from Bing to OSM, and (as might be expected) it worked fine. The only issue I have now is the manager doesn't like the look of the OSM themes (or Google, FTM). Guess I'll see what it takes to develop an acceptable OSM theme. – JustaJoe Jan 7 '14 at 17:00
  • @JustaJoe you're welcome! glad to help, this one may help you out to style your OSM basemap: oegeo.wordpress.com/2010/11/02/style-your-own-openstreetmap – Gery Jan 7 '14 at 18:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.