Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Following OpenLayers map printing demo here, I'm able to get my map in image format. But I'm facing two issues with the export:

  1. Google Street base map is not included in the image output;
  2. Whenever I activate any WMS layer, the export fails with the error TypeMismatchError: The type of an object is incompatible with the expected type of the parameter associated to the object

To get an image output of the map, I'm using Canvas.toDataURL(), which opens another window with the image of my WFS layers. According to the demo, when using Canvas.toDataURL(), images should be requested through a proxy, a point I don't understand as far as Google base layer is concerned. Any clarification will be appreciated.

I'm not sure what I may be doing wrong. Below shows how I retrieve Google base map and WMS layers:

Google base map:

var gStreet = new OpenLayers.Layer.Google(
            'Google Street',
            {numZoomLevels: 19},
            {visibility: true},
            {isBaseLayer: true},
            {useCanvas: OpenLayers.Layer.Grid.ONECANVASPERLAYER}
    );

WMS Layer:

var wmsLayer = new OpenLayers.Layer.WMS("My WMS Layer",
        GEOSERVER_HOST + "/wms", 
        {layers: "wms_layer", format: 'image/png'},
        {
            useCanvas: OpenLayers.Layer.Grid.ONECANVASPERLAYER,
            isBaseLayer: false
        }
    );

GEOSERVER_HOST is proxied via Apache web server. I've configured Apache to channel all GeoServer requests as necessary. As such, I'm not making direct request to GeoServer in my client.

Any idea on what I may be doing wrong will be appreciated.

share|improve this question
1  
You may need to use static maps api: developers.google.com/maps/documentation/staticmaps –  U2ros Sep 25 '12 at 9:05
    
Thanks for the suggestion, @U2ros. –  okello Sep 25 '12 at 9:13
    
Following the example of google staticmaps at openlayers.org/dev/examples/google-static.html, I've been trying in vain to get it working. If you know of a working OL google static map example, plz post a link. –  okello Sep 27 '12 at 7:12
    
erm, i think the examples pretty much start from scratch. The whole map generation is controleed via parameters passed by the URL, the api then returns an image. My suggestion is, copy a working example URL from there, and play with parameters to get comfortable. –  U2ros Sep 27 '12 at 8:56
    
I got the static map working. I'll now test it with the printing. –  okello Sep 27 '12 at 9:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.