| 173 | | if u.info()['Content-Type'] == 'text/xml': |
|---|
| 174 | | #going to have to read the xml to see if it's an exception report. |
|---|
| 175 | | #wrap the url stram in a extended StringIO object so it's re-readable |
|---|
| 176 | | u=RereadableURL(u) |
|---|
| 177 | | se_xml= u.read() |
|---|
| 178 | | se_tree = etree.fromstring(se_xml) |
|---|
| 179 | | serviceException=se_tree.find('{http://www.opengis.net/ows}Exception') |
|---|
| 180 | | if serviceException is not None: |
|---|
| 181 | | raise ServiceException, \ |
|---|
| 182 | | str(serviceException.text).strip() |
|---|
| 183 | | u.seek(0) |
|---|
| | 173 | if 'content-type' in u.info().keys(): |
|---|
| | 174 | if u.info()['content-type'] == 'text/xml': |
|---|
| | 175 | #going to have to read the xml to see if it's an exception report. |
|---|
| | 176 | #wrap the url stram in a extended StringIO object so it's re-readable |
|---|
| | 177 | u=RereadableURL(u) |
|---|
| | 178 | se_xml= u.read() |
|---|
| | 179 | se_tree = etree.fromstring(se_xml) |
|---|
| | 180 | serviceException=se_tree.find('{http://www.opengis.net/ows}Exception') |
|---|
| | 181 | if serviceException is not None: |
|---|
| | 182 | raise ServiceException, \ |
|---|
| | 183 | str(serviceException.text).strip() |
|---|
| | 184 | u.seek(0) |
|---|
| 218 | | #NOTE: do these belong here? |
|---|
| 219 | | self.fees=elem.find('{http://www.opengis.net/wcs/1.1/ows}Fees').text |
|---|
| 220 | | self.accessConstraints=elem.find('{http://www.opengis.net/wcs/1.1/ows}AccessConstraints').text |
|---|
| | 222 | if elem.find('{http://www.opengis.net/wcs/1.1/ows}Fees'): |
|---|
| | 223 | self.fees=elem.find('{http://www.opengis.net/wcs/1.1/ows}Fees').text |
|---|
| | 224 | else: |
|---|
| | 225 | self.fees=None |
|---|
| | 226 | |
|---|
| | 227 | if elem.find('{http://www.opengis.net/wcs/1.1/ows}AccessConstraints'): |
|---|
| | 228 | self.accessConstraints=elem.find('{http://www.opengis.net/wcs/1.1/ows}AccessConstraints').text |
|---|
| | 229 | else: |
|---|
| | 230 | self.accessConstraints=None |
|---|
| 321 | | lc=b.find('{http://www.opengis.net/ows}LowerCorner').text |
|---|
| 322 | | uc=b.find('{http://www.opengis.net/ows}UpperCorner').text |
|---|
| 323 | | boundingBox = ( |
|---|
| 324 | | float(lc.split()[0]),float(lc.split()[1]), |
|---|
| 325 | | float(uc.split()[0]), float(uc.split()[1]), |
|---|
| 326 | | b.attrib['crs']) |
|---|
| 327 | | self.boundingBoxes.append(boundingBox) |
|---|
| 328 | | |
|---|
| | 331 | try: |
|---|
| | 332 | lc=b.find('{http://www.opengis.net/ows}LowerCorner').text |
|---|
| | 333 | uc=b.find('{http://www.opengis.net/ows}UpperCorner').text |
|---|
| | 334 | boundingBox = ( |
|---|
| | 335 | float(lc.split()[0]),float(lc.split()[1]), |
|---|
| | 336 | float(uc.split()[0]), float(uc.split()[1]), |
|---|
| | 337 | b.attrib['crs']) |
|---|
| | 338 | self.boundingboxes.append(boundingBox) |
|---|
| | 339 | except: |
|---|
| | 340 | pass |
|---|
| | 341 | |
|---|