Test ESRI WCS with OWSLib


In [1]:
from owslib.wcs import WebCoverageService
endpoint='http://olga.er.usgs.gov/stpgis/services/lidar/Bare_Earth_Lidar/MapServer/WCSServer?request=GetCapabilities&service=WCS'

In [2]:
wcs = WebCoverageService(endpoint,version='1.0.0',timeout=60)

In [3]:
for k,v in wcs.contents.iteritems():
    print v.title


DEM (NAVD88)_56
OFR 06-1244 Dry Tortugas Nat'l Park_77
DEM (NAVD88)_54
DEM (NAVD88)_42
DEM (NAVD88)_48
DS 389 Jean Lafitte Nat'l Historic Park_43
DEM (NAVD88)_60
OFR 07-1177 Thomas Stone Nat'l Historic Site _61
DEM (NAVD88)_62
OFR 07-1178 Gateway Nat'l Recreation Area_63
DEM (NAVD88)_64
OFR 07-1431 Padre Island Nat'l Seashore_49
DEM (NAVD88)_66
DS 627 Eastern Florida (post-Hurricane Jeanne)_67
DEM (NAVD88)_68
DS 528 Eastern Florida (post-Hurricane Frances)_69
DEM (m WGS84)_80
DEM (NAVD88)_52
OFR 07-1394 Sagamore Hills Nat'l Historic Site_53
DEM (NAVD88)_84
DEM (NAVD88)_24
DS 556 Mississippi and Alabama Barrier Islands_25
DEM (NAVD88)_26
DS 447 Assateague Island_27
DEM (NAVD88)_20
DS 557 Sandy Hook, NJ_21
DEM (NAVD88)_22
DS 525 Gateway Nat'l Recreation Area_23
DEM (m NAVD88)_46
OFR 08-1326 Colonial Hist. Site_47
DEM (NAVD88)_44
OFR 2007-1395 Florida Keys Nat'l Marine Sanctuary_45
DEM (NAVD88)_28
DS 416 Pearl River Delta_29
DEM (NAVD88)_40
DS 400 Northern Gulf of Mexico_41
DS 628 Assateague Island_1
DEM (NAVD88)_82
DS 617 Potato Creek, GA_3
DEM (NAVD88)_2
DS 618 Three Mile Creek and Mobile-Tensaw_5
DEM (NAVD88)_4
DS 511 Chandeleur Islands_7
DEM (NAVD88)_6
DS 616 Northern Outer Banks, NC_9
DEM (NAVD88)_8
DEM (NAVD88)_78
OFR 07-1422 Gulf Islands Nat'l Seashore, Florida_51
OFR 06-1118 Biscayne Nat'l Park_83
DS 398 Northeast Barrier Islands_39
OFR 06-1384 Fire Island, NY_65
DEM (NAVD88)_76
OFR 07-1176 Assateague Island_75
DEM (NAVD88)_38
DS 384 Northern Gulf of Mexico_73
DEM (NAVD88)_72
DS 482 Western Florida_71
DEM (NAVD88)_70
OFR 07-1179 George Washington Birthplace Nat'l Monument_59
DS 395 Virgin Islands_79
DEM (NAVD88)_58
DS 578 Cape Hatteras, NC_11
DEM (NAVD88)_10
DS 565 Fire Island, NY (post-Hurricane Frances)_13
DEM (NAVD88)_12
DS 562 Maryland and Delaware coasts_15
DEM (NAVD88)_14
DS 559 Assateague Island_17
DEM (NAVD88)_16
DS 558 Fire Island, NY (post-Nor'Ida)_19
DEM (NAVD88)_18
DS 401 George Washington Birthplace Nat'l Monument_31
DEM (NAVD88)_30
DS 393 Sandy Hook_37
DEM (NAVD88)_36
DS 391 Fire Island, NY_35
DEM (NAVD88)_34
DS 390 Vicksburg Nat'l Military Park_33
OFR 07-1375 Cape Code Nat'l Seashore_55
DEM (NAVD88)_74
DEM (NAVD88)_32
OFR 07-1432 Northern Florida Keys Reef Tract_81
OFR 07-1377 Gulf Islands Nat'l Seashore, Mississippi_57
DEM (NAVD88)_50

In [4]:
wcs['1'].title


Out[4]:
'DS 628 Assateague Island_1'

In [5]:
cvg = wcs['1']
print cvg.title
print cvg.boundingBoxWGS84


DS 628 Assateague Island_1
(-75.41186096051426, 37.83872212674116, -75.06819077503195, 38.32610245033198)

In [6]:
print cvg.supportedFormats


[]

In [7]:
print cvg.supportedCRS


[]

In [8]:
output = wcs.getCoverage(identifier=['1'],bbox=(-75.4,37.8,-75.2,38.0),crs='EPSG:4326',format='GeoTIFF')

In [9]:
f=open('test.tif','wb')
f.write(output.read())
f.close()

In [10]:
!more test.tif


<?xml version="1.0" encoding="UTF-8" ?>
<ServiceExceptionReport version="1.2.0" xmlns="http://www.opengis.net/ogc" xmlns
:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.
opengis.net/ogc http://schemas.opengeospatial.net/wms/1.1.1/OGC-exception.xsd"> 
 <ServiceException code="InvalidParameterValue">
parameter COVERAGE is invalid
  </ServiceException>
</ServiceExceptionReport>

In [10]: