23 |
class WMSLayer: |
class WMSLayer: |
24 |
__init__() |
__init__() |
25 |
|
|
26 |
|
LatLongBoundingBox() |
27 |
|
BoundingBox() |
28 |
|
|
29 |
|
getFormat(format) |
30 |
|
calcFormat(formats) |
31 |
|
|
32 |
|
GetMapImg(width, height, bbox) |
33 |
|
|
34 |
Requirements: |
Requirements: |
35 |
- PyOGCLib <http://www.sourceforge.net/projects/pyogclib> |
- PyOGCLib <http://www.sourceforge.net/projects/pyogclib> |
73 |
|
|
74 |
|
|
75 |
class WMSLayer(BaseLayer): |
class WMSLayer(BaseLayer): |
76 |
|
""" |
77 |
|
WMS Layer |
78 |
|
|
79 |
|
This layer incorporates all methods from the Thuban BaseLayer and |
80 |
|
adds specific methods for operating with a WMS server. |
81 |
|
""" |
82 |
|
|
83 |
def __init__(self, title, url): |
def __init__(self, title, url): |
84 |
"""Initializes the WMSLayer. |
"""Initializes the WMSLayer. |
160 |
|
|
161 |
|
|
162 |
def LatLongBoundingBox(self): |
def LatLongBoundingBox(self): |
163 |
"""Return the layer's bounding box in lat-lon. |
""" |
164 |
|
Return the layer's bounding box in lat-lon |
165 |
""" |
""" |
166 |
return self.latlonbbox |
return self.latlonbbox |
167 |
|
|
168 |
|
|
169 |
def BoundingBox(self): |
def BoundingBox(self): |
170 |
"""Return the layer's bounding box in the intrinsic coordinate system. |
""" |
171 |
|
Return the layer's bounding box in the intrinsic coordinate system |
172 |
""" |
""" |
173 |
return self.bbox |
return self.bbox |
174 |
|
|
179 |
|
|
180 |
format -- format as returned by the WMS server |
format -- format as returned by the WMS server |
181 |
|
|
182 |
If no mapping was found, None is returned |
If no mapping was found, None is returned. |
183 |
|
|
184 |
|
This routine uses a simple heuristic in order to find the |
185 |
|
broken down image format to be used with the internal render |
186 |
|
engine. |
187 |
|
|
188 |
An exception rule is implemented in order to not accept |
An exception rule is implemented in order to not accept |
189 |
image/wbmp or WBMP which refers to WAP bitmap format and is |
image/wbmp or WBMP which refers to WAP bitmap format and is |
232 |
|
|
233 |
|
|
234 |
def GetMapImg(self, width, height, bbox): |
def GetMapImg(self, width, height, bbox): |
235 |
|
""" |
236 |
|
Retrieve a new map from the WMS server and return it |
237 |
|
|
238 |
|
width -- width in pixel of the desired image |
239 |
|
height -- height in pixel of the desired image |
240 |
|
bbox -- array of min(x,y) max(x,y) in the given SRS |
241 |
|
|
242 |
|
SRS and used image format will be retrieved from within the |
243 |
|
layer itself. |
244 |
|
""" |
245 |
bbox_dict = { 'minx': bbox[0], 'miny': bbox[1], |
bbox_dict = { 'minx': bbox[0], 'miny': bbox[1], |
246 |
'maxx': bbox[2], 'maxy': bbox[3] } |
'maxx': bbox[2], 'maxy': bbox[3] } |
247 |
|
|