premiers notebooks
This commit is contained in:
parent
261adb54ce
commit
a3a02b3688
3 changed files with 1957 additions and 0 deletions
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
.ipynb_checkpoints/
|
||||
|
1490
ckan_donnees_quebec.ipynb
Normal file
1490
ckan_donnees_quebec.ipynb
Normal file
File diff suppressed because it is too large
Load diff
465
service_wms_canada.ipynb
Normal file
465
service_wms_canada.ipynb
Normal file
|
@ -0,0 +1,465 @@
|
|||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from owslib.wms import WebMapService"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"wms = WebMapService('http://cartes.geogratis.gc.ca/wms/elevation_fr?', version='1.3.0')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Propriétés du service web WMS"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"'WMS'"
|
||||
]
|
||||
},
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"wms.identification.type"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"'1.3.0'"
|
||||
]
|
||||
},
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"wms.identification.version"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"u\"Service de cartographie Web (WMS) pour les donn\\xe9es d'\\xe9l\\xe9vation\""
|
||||
]
|
||||
},
|
||||
"execution_count": 7,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"wms.identification.title"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"u\"Ressources naturelles Canada offre un acc\\xe8s aux donn\\xe9es d'\\xe9l\\xe9vation par le biais d'un service de cartographie Web commun\\xe9ment appel\\xe9 Web Mapping Service (WMS) dont les sp\\xe9cifications sont d\\xe9finies par l'Open Geospatial Consortium (OGC).\""
|
||||
]
|
||||
},
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"wms.identification.abstract"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"['WMS-Elevation',\n",
|
||||
" 'cdsm.color-shaded-relief',\n",
|
||||
" 'cdsm.color-shaded-relief.legend',\n",
|
||||
" 'cdem.color-shaded-relief',\n",
|
||||
" 'cdem.color-shaded-relief.legend']"
|
||||
]
|
||||
},
|
||||
"execution_count": 9,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"list(wms.contents)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Propriétés d'une couche du service web WMS"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 72,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"u\"Service de cartographie Web (WMS) pour les donn\\xe9es d'\\xe9l\\xe9vation\""
|
||||
]
|
||||
},
|
||||
"execution_count": 72,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"wms['WMS-Elevation'].title"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 73,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"(-180.0, -90.0, 180.0, 90.0)"
|
||||
]
|
||||
},
|
||||
"execution_count": 73,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"wms['WMS-Elevation'].boundingBoxWGS84"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 74,
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"scrolled": true
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"['EPSG:3857',\n",
|
||||
" 'EPSG:53016',\n",
|
||||
" 'EPSG:32186',\n",
|
||||
" 'EPSG:26707',\n",
|
||||
" 'EPSG:2295',\n",
|
||||
" 'EPSG:2294',\n",
|
||||
" 'EPSG:26708',\n",
|
||||
" 'EPSG:26709',\n",
|
||||
" 'EPSG:26908',\n",
|
||||
" 'EPSG:26909',\n",
|
||||
" 'EPSG:26907',\n",
|
||||
" 'EPSG:32192',\n",
|
||||
" 'EPSG:32193',\n",
|
||||
" 'EPSG:32190',\n",
|
||||
" 'EPSG:32191',\n",
|
||||
" 'EPSG:32196',\n",
|
||||
" 'EPSG:32197',\n",
|
||||
" 'EPSG:32194',\n",
|
||||
" 'EPSG:32195',\n",
|
||||
" 'EPSG:32198',\n",
|
||||
" 'EPSG:104306',\n",
|
||||
" 'EPSG:26715',\n",
|
||||
" 'EPSG:26714',\n",
|
||||
" 'EPSG:26717',\n",
|
||||
" 'EPSG:26716',\n",
|
||||
" 'EPSG:26711',\n",
|
||||
" 'EPSG:26710',\n",
|
||||
" 'EPSG:26713',\n",
|
||||
" 'EPSG:26712',\n",
|
||||
" 'EPSG:26719',\n",
|
||||
" 'EPSG:26718',\n",
|
||||
" 'EPSG:4269',\n",
|
||||
" 'EPSG:26919',\n",
|
||||
" 'EPSG:26918',\n",
|
||||
" 'EPSG:26917',\n",
|
||||
" 'EPSG:26916',\n",
|
||||
" 'EPSG:26915',\n",
|
||||
" 'EPSG:26914',\n",
|
||||
" 'EPSG:26913',\n",
|
||||
" 'EPSG:26912',\n",
|
||||
" 'EPSG:26911',\n",
|
||||
" 'EPSG:26910',\n",
|
||||
" 'EPSG:32181',\n",
|
||||
" 'EPSG:3979',\n",
|
||||
" 'EPSG:32183',\n",
|
||||
" 'EPSG:32182',\n",
|
||||
" 'EPSG:32185',\n",
|
||||
" 'EPSG:32184',\n",
|
||||
" 'EPSG:32187',\n",
|
||||
" 'EPSG:3978',\n",
|
||||
" 'EPSG:32189',\n",
|
||||
" 'EPSG:32188',\n",
|
||||
" 'EPSG:26720',\n",
|
||||
" 'EPSG:26721',\n",
|
||||
" 'EPSG:26722',\n",
|
||||
" 'EPSG:900913',\n",
|
||||
" 'EPSG:41001',\n",
|
||||
" 'EPSG:4617',\n",
|
||||
" 'EPSG:102184',\n",
|
||||
" 'EPSG:102185',\n",
|
||||
" 'EPSG:3579',\n",
|
||||
" 'EPSG:3578',\n",
|
||||
" 'EPSG:3575',\n",
|
||||
" 'EPSG:3574',\n",
|
||||
" 'EPSG:3576',\n",
|
||||
" 'EPSG:3571',\n",
|
||||
" 'EPSG:3573',\n",
|
||||
" 'EPSG:3572',\n",
|
||||
" 'EPSG:54030',\n",
|
||||
" 'EPSG:102100',\n",
|
||||
" 'EPSG:102002',\n",
|
||||
" 'EPSG:102009',\n",
|
||||
" 'EPSG:102008',\n",
|
||||
" 'EPSG:3401',\n",
|
||||
" 'EPSG:3799',\n",
|
||||
" 'EPSG:3395',\n",
|
||||
" 'EPSG:3400',\n",
|
||||
" 'EPSG:54008',\n",
|
||||
" 'EPSG:54009',\n",
|
||||
" 'EPSG:54004',\n",
|
||||
" 'EPSG:54003',\n",
|
||||
" 'EPSG:102016',\n",
|
||||
" 'EPSG:102017',\n",
|
||||
" 'EPSG:102018',\n",
|
||||
" 'EPSG:2019',\n",
|
||||
" 'EPSG:4326',\n",
|
||||
" 'EPSG:54016',\n",
|
||||
" 'EPSG:42101',\n",
|
||||
" 'EPSG:2952',\n",
|
||||
" 'EPSG:42304',\n",
|
||||
" 'EPSG:26922',\n",
|
||||
" 'EPSG:26920',\n",
|
||||
" 'EPSG:26921']"
|
||||
]
|
||||
},
|
||||
"execution_count": 74,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"wms['WMS-Elevation'].crsOptions"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 75,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"{}"
|
||||
]
|
||||
},
|
||||
"execution_count": 75,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"wms['WMS-Elevation'].styles"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 76,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"['GetCapabilities', 'GetMap', 'GetFeatureInfo', 'GetLegendGraphic']"
|
||||
]
|
||||
},
|
||||
"execution_count": 76,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"[op.name for op in wms.operations]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 79,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"['image/png', 'image/gif', 'image/jpeg', 'image/png; mode=8bit', 'image/tiff']"
|
||||
]
|
||||
},
|
||||
"execution_count": 79,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"wms.getOperationByName('GetMap').formatOptions"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Exemple de requête"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 80,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"img = wms.getmap(layers=['WMS-Elevation'],\n",
|
||||
" srs='EPSG:4269',\n",
|
||||
" bbox=(-72.25,-71.25,46.25,47.25),\n",
|
||||
" size=(450,450),\n",
|
||||
" format='image/png',\n",
|
||||
" transparent=True)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 81,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"out = open('canada-wms.png', 'wb')\n",
|
||||
"out.write(img.read())\n",
|
||||
"out.close()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"![](canada-cdsm.png)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"anaconda-cloud": {},
|
||||
"kernelspec": {
|
||||
"display_name": "Python [default]",
|
||||
"language": "python",
|
||||
"name": "python2"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 2
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython2",
|
||||
"version": "2.7.12"
|
||||
},
|
||||
"widgets": {
|
||||
"state": {
|
||||
"bc6d60e3e9e349c2befeef1fbd33b91d": {
|
||||
"views": [
|
||||
{
|
||||
"cell_index": 16
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"version": "1.2.0"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 1
|
||||
}
|
Loading…
Reference in a new issue