[Users] GeoExt.ux.SimplePrint questions

BERÉNYI Attila atis at airdesignstudio.hu
Wed Feb 2 16:20:22 CET 2011


Hi!

Sorry, for the delayed reply, I had an extremely busy week.
1. Your solution seems very elegant indeed, even though I was able to 
reconfigure OL to parse TMS layers as TileCache layers - and it works 
now, I'll give it a try.
2. Honestly, I wasn't really optimistic about this from the beginning, 
so that's not a surprise.
3. I've completely bypassed the proxy script and the different port 
number, using apache's mod_proxy, now POST works like a charm.

Thanks for your help!

Cheers,
Attila

2011.01.27. 11:14 keltezéssel, Ivan Grcic írta:
> Hi Attila,
>
> please read below:
>
> 2011/1/26 BERÉNYI Attila<atis at airdesignstudio.hu>:
>> Dear All,
>>
>> I have a few question regarding GeoExt ux: SimplePrint.
>> 1. My original configuration applied TMS layers (MapProxy), and by default
>> it generates the following error:
>> I've tried to reconfigure it using override object, but neither the
>> type:'WMS' (#1), nor the duplicated layer definition (#2, defining a
>> 'hidden' WMS layer with the same content) helped. The overrides parameters
>> seems to be ignored.
>>
>> var TMSlayer = new OpenLayers.Layer.TMS('TMSLayerName', TMSService, {
>>      layername: 'TMSLayerName',
>>      type: 'png',
>>      tileSize: new OpenLayers.Size(512, 512)
>> });
>>
>> var WMSLayer = new OpenLayers.Layer.WMS('WMSLayerName', WMSService, {
>>      layers: 'WMSLayerName',
>>      format: 'image/png'
>> }, {
>>      singleTile: true,
>>      ratio: 1
>> }, {
>>      isBaseLayer: false,
>>      visibility: false,
>>      displayInLayerSwitcher: false
>> });
>>
>> #1
>> var overrides = {
>>      'TMSLayerName': {
>>          baseURL: WMSService,
>>          type: 'WMS',
>>          layers: 'WMSLayerName'
>>      }
>> };
>>
>> #2
>> var overrides = {
>>      'WMSLayerName': {
>>          visibility: true
>>      },
>>      'TMSLayerName': {
>>          visibility: false
>>      },
>> };
>>
>> var printForm = new GeoExt.ux.SimplePrint({
>>      ...
>>      overrides: overrides,
>>      ...
>> });
>>
>> TileCache layer works out of the box (override object is not required, but a
>> new virtual directory is needed).
>> var TCLayer = new OpenLayers.Layer.TileCache('TCLayerName', TCService,
>> 'TCLayerName', {
>>      isBaseLayer: true,
>>      ...
>> });
>>
>> Can I use override parameter or it is not implemented yet?
>>
> i dont think override is there in GeoExt yet! (please somebody correct
> me if Im wrong)
>
> But there is another pretty elegant solution you can make:
> There are several events you can hook on, and change desired
> parameters before sending them to print. This is what i was doing:
>
> Define two more parameters for layer, such as printUrl and printLayerName ie:
>
> var WMSLayer = new OpenLayers.Layer.WMS('WMSLayerName', WMSService, {
>      layers: 'WMSLayerName',
>      format: 'image/png'
> }, {
>      singleTile: true,
>      ratio: 1
> }, {
>      isBaseLayer: false,
>      visibility: false,
>      displayInLayerSwitcher: false,
>      printUrl: GeoserverWMS,
>      printLayerName:
> });
>
> and then just hook onto encodeLayer and change required parameters there.
>
> Heres an example:
> printProvider.on({
>          'encodelayer' : function(provider, layer, encodedLayer){
>              if(layer.printUrl){
>                  encodedLayer.baseURL = provider.getAbsoluteUrl(layer.printUrl);
>                  if(layer.printLayerName){
>                      encodedLayer.layers =
> [layer.printLayerName].join(",").split(",");
>                  }
>              }
>              return encodedLayer;
>          }
> });
>
> Let us know if it worked!
>
>
>> 2. It is possible to print Google layers? I've set my config.yaml according
>> to the sample here:
>> http://trac.mapfish.org/trac/mapfish/browser/print/trunk/samples/configNonPremiumGoogle.yaml,
>> but the result is still a blank white page.
>> I'm using Google API v3, if it counts.
>>
> Looking into I dont see google encoder still, so I dont think this is
> possible (pleae correct me somebody)
>
>> 3. I wasn't able to use the POST method in the printprovider, the request
>> does not contain POST parameters, however GET works just fine.
>> var printProvider = new GeoExt.data.PrintProvider({
>>      //method: "POST",
>>      method: "GET",
>>      url: "proxy.cgi?url=http://localhost:8080/geoserver/pdf",
>>      autoLoad: true
>> });
> I didnt have any problems with POST (actually when config object gets
> bigger this is the only method you should use). Maybe some proxy
> problems?
>
> Hope this helps,
> Cheers
>> Cheers,
>> Attila
>>
>> _______________________________________________
>> Users mailing list
>> Users at geoext.org
>> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>>
>>
>
>


More information about the Users mailing list