Hello,

I would like to suggest 2 patchs.
The first is  for supporting custom parameters of WMS, I don't know if it's
normalize by OGC, but it's supported by Mapserver.
For exemple I have this request  in openlayers:

http://wmshost/cgi-bin/xyea?LAYERS=oursindep%2Cetablissement&FORMAT=jpg&IDOURSIN=%20uai_dger%7C%7Cinsee_resplegal%20%7C%7Cfiliere_code%7C%7Csecteur_pro_code%7C%7Coption_code&GROUPBYCLAUSE=%20GROUP%20BY%20%20uai_dger&WHERECLAUSE=%20WHERE%20secteur_code%20%3D%201&GEOMSUFFIXE=_rel&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A27572&BBOX=-679807.84,1230100.62,1925309.84,2987770.38&WIDTH=996&HEIGHT=672

And this is the request with my owslib patched :

      url_wms = 'http://wmshost/cgi-bin/xyea'
      layers = [ 'oursindep', 'etablissement', 'responsables_legaux',
'regions']
      bbox = (-10.900634765625, 36.857250976562, 15.400634765625,
55.742749023437)
      styles = ''
      custom = {'WHERECLAUSE':'WHERE secteur_code = 1',
                'GROUPBYCLAUSE':'GROUP BY uai_dger',
                'IDOURSIN':'uai_dger||insee_resplegal
||filiere_code||secteur_pro_code||option_code'}
img = wms.getmap(layers=layers,
                       styles=styles,
                       bbox=bbox,
                       size=(1197, 859),
                       format='image/jpeg',
                       srs='EPSG:4326',
                       custom = custom
                       )

And the second is for solve encoding problem when the return of the wms
server is not ascii.
--- wms2.py     2009-10-09 18:45:46.000000000 +0200
+++ wms.py      2009-10-09 11:39:14.000000000 +0200
@@ -153,7 +153,8 @@
                format=None, size=None, time=None, transparent=False,
                bgcolor='#FFFFFF',
                exceptions='application/vnd.ogc.se_xml',
-               method='Get'
+               method='Get',
+               custom = []
                ):
         """Request and return an image from the WMS as a file-like object.
         
@@ -178,7 +179,8 @@
             Optional. Image background color.
         method : string
             Optional. HTTP DCP method name: Get or Post.
-        
+        vendor : dict
+            OPtionnal : vendor parameters for wms server
         Example
         -------
             >>> img = wms.getmap(layers=['global_mosaic'],
@@ -188,6 +190,7 @@
             ...                  format='image/jpeg',
             ...                  size=(300,250),
             ...                  transparent=True,
+            ...                  vendor = {'filter':'river'},
             ...                  )
             >>> out = open('example.jpg', 'wb')
             >>> out.write(img.read())
@@ -216,6 +219,7 @@
         request['transparent'] = str(transparent).upper()
         request['bgcolor'] = '0x' + bgcolor[1:7]
         request['exceptions'] = str(exceptions)
+        request.update(custom)
         
         if time is not None:
             request['time'] = str(time)

Attachment: patch-wms2.patch
Description: Binary data

_______________________________________________
Community mailing list
[email protected]
http://lists.gispython.org/mailman/listinfo/community

Reply via email to