Merge branch 'epi'

intro16
Angelos Tzotsos 2016-04-18 16:23:44 +03:00
commit 127036b295
21 changed files with 1605 additions and 601 deletions

View File

@ -15,7 +15,7 @@
"\n",
"The first Notebook is dedicated to the use of the Geospatial Data Abstraction Library (**GDAL**) from the bash command line. GDAL is a powerful translator library for raster and vector geospatial data formats it presents a single raster abstract data model and vector abstract data model to the calling application for all supported formats.\n",
"\n",
"This Notebook is derived from the original [GDAL-OGR quickstart](http://localhost/osgeolive/en/quickstart/gdal_quickstart.html) adapted to run interactively in a IPython notebook and is composed by two main parts **GDAL** (to handle raster data) and **OGR** (to work with vector data)\n",
"This Notebook is derived from the original [GDAL-OGR quickstart](http://localhost/osgeolive/en/quickstart/gdal_quickstart.html) adapted to run interactively in an IPython notebook and is composed by two main parts **GDAL** (to handle raster data) and **OGR** (to work with vector data)\n",
"\n",
"<h1 style=\"margin: 0.0px 0.0px 0.0px 0.0px; line-height: 15.4px; font: 18.0px 'Lucida Sans'; color: #004d87; -webkit-text-stroke: #004d87; background-color: #ffffff\"><span class=\"s1\">GDAL</span></h1>\n",
"\n",
@ -54,9 +54,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"from IPython.core.display import Image"
@ -72,9 +70,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"DATADIR='/home/user/data/natural_earth2'"
@ -83,9 +79,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"OUTPUTDIR='/home/user/jupyter/notebooks/GSOC/OUTPUT/'"
@ -103,9 +97,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!gdalinfo --help-general"
@ -114,9 +106,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!gdalinfo {DATADIR}/HYP_50M_SR_W.tif"
@ -160,10 +150,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false,
"scrolled": true
},
"metadata": {},
"outputs": [],
"source": [
"!gdalinfo --formats"
@ -189,13 +176,10 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false,
"scrolled": true
},
"metadata": {},
"outputs": [],
"source": [
"!gdalinfo --format GTiff "
"!gdalinfo --format GTiff"
]
},
{
@ -219,9 +203,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!gdal_translate -of JPEG -co QUALITY=10 {DATADIR}/HYP_50M_SR_W.tif {OUTPUTDIR}/HYP_50M_SR_W.jpg"
@ -237,9 +219,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"Image(OUTPUTDIR+'/HYP_50M_SR_W.jpg')"
@ -255,9 +235,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!gdal_translate -ot Int16 {DATADIR}/HYP_50M_SR_W.tif {OUTPUTDIR}/HYP_50M_SR_W_Int16.tif"
@ -273,9 +251,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!gdalinfo {DATADIR}/HYP_50M_SR_W.tif | grep Band"
@ -284,9 +260,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!gdalinfo {OUTPUTDIR}/HYP_50M_SR_W_Int16.tif | grep Band"
@ -304,9 +278,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!gdal_translate -outsize 50% 50% {DATADIR}/HYP_50M_SR_W.tif {OUTPUTDIR}/HYP_50M_SR_W_small.tif"
@ -322,9 +294,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!gdalinfo {DATADIR}/HYP_50M_SR_W.tif | grep Size"
@ -333,9 +303,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!gdalinfo {OUTPUTDIR}/HYP_50M_SR_W_small.tif | grep Size"
@ -360,9 +328,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!gdalinfo -mm {OUTPUTDIR}/HYP_50M_SR_W_small.tif | grep Min/Max"
@ -378,9 +344,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!gdal_translate -scale_1 62.000 255.000 0 255.000 \\\n",
@ -399,9 +363,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!gdalinfo -mm {OUTPUTDIR}/HYP_50M_SR_W_scaled.tif | grep Min/Max"
@ -417,9 +379,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!gdal_translate -of JPEG -co QUALITY=40 {OUTPUTDIR}/HYP_50M_SR_W_scaled.tif {OUTPUTDIR}/HYP_50M_SR_W_scaled.jpg"
@ -428,9 +388,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"Image(OUTPUTDIR+'/HYP_50M_SR_W_scaled.jpg')"
@ -460,9 +418,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!gdal_translate -srcwin 0 0 5400 5400 {DATADIR}/HYP_50M_SR_W.tif {OUTPUTDIR}/west.tif\n",
@ -472,9 +428,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!gdal_translate -of JPEG -co QUALITY=40 {OUTPUTDIR}/east.tif {OUTPUTDIR}/east.jpg\n",
@ -508,9 +462,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!gdalwarp -t_srs '+proj=merc +datum=WGS84' {DATADIR}/HYP_50M_SR_W.tif {OUTPUTDIR}/mercator.tif"
@ -519,9 +471,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!gdal_translate -of JPEG -co QUALITY=40 {OUTPUTDIR}/mercator.tif {OUTPUTDIR}/mercator.png"
@ -530,9 +480,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"Image(OUTPUTDIR+'/mercator.png')"
@ -548,9 +496,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!gdalwarp -t_srs '+proj=ortho +datum=WGS84' {DATADIR}/HYP_50M_SR_W.tif {OUTPUTDIR}/ortho.tif 2>/dev/null"
@ -559,9 +505,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!gdal_translate -of JPEG -co QUALITY=40 {OUTPUTDIR}/ortho.tif {OUTPUTDIR}/ortho.png"
@ -570,10 +514,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false,
"scrolled": true
},
"metadata": {},
"outputs": [],
"source": [
"Image(OUTPUTDIR+'/ortho.png')"
@ -593,9 +534,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!gdaltindex {OUTPUTDIR}/index_natural_earth.shp {OUTPUTDIR}/*st.tif"
@ -620,9 +559,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!gdal_merge.py {OUTPUTDIR}/east.tif {OUTPUTDIR}/west.tif -o {OUTPUTDIR}/merged.tif"
@ -638,9 +575,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!gdal_translate -of JPEG -co QUALITY=40 {OUTPUTDIR}/merged.tif {OUTPUTDIR}/merged.jpg"
@ -649,9 +584,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"Image(OUTPUTDIR+'/merged.jpg')"
@ -686,9 +619,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!ogrinfo {OUTPUTDIR}/index_natural_earth.shp index_natural_earth"
@ -704,9 +635,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"!ogrinfo -ro -so {DATADIR}/ne_10m_admin_0_countries.shp ne_10m_admin_0_countries"
@ -722,9 +651,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"!ogrinfo -ro {DATADIR}/ne_10m_admin_0_countries.shp ne_10m_admin_0_countries | grep 'admin '"
@ -747,9 +674,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"index_natural_earth=\"\"\"\n",
@ -857,9 +782,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"mapfile=open('index_natural_earth.map','w')\n",
@ -870,9 +793,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!shp2img -m index_natural_earth.map -i PNG -o index_natural_earth.png"
@ -881,9 +802,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"Image('index_natural_earth.png')"
@ -902,9 +821,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!ogrinfo --formats"
@ -927,9 +844,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!rm -rf {DATADIR}/countries.json\n",
@ -939,9 +854,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"#"
@ -964,7 +877,7 @@
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
"version": 2.0
},
"file_extension": ".py",
"mimetype": "text/x-python",
@ -976,4 +889,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}

View File

@ -2,9 +2,7 @@
"cells": [
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"metadata": {},
"source": [
"<h1><center>[Notebooks](../) - [Access to Geospatial data](../Access to Geospatial data)</center></h1>"
]
@ -33,9 +31,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"from geographiclib.geodesic import Geodesic\n",
@ -56,9 +52,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"gc = [Geodesic.WGS84.Direct(lat1, lon1, g['azi1'], i) for i in range(0,int(g['s12']),100000)]"
@ -76,9 +70,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"from osgeo import ogr\n",
@ -95,9 +87,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"point1 = ogr.Geometry(ogr.wkbPoint)\n",
@ -119,9 +109,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"line = ogr.Geometry(ogr.wkbLineString)"
@ -131,15 +119,13 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"And let's populate the newly generated line feature looping trought the list of coordinates of our geodesic path."
"And let's populate the newly generated line feature looping through the list of coordinates of our geodesic path."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"[line.AddPoint(i['lon2'],i['lat2']) for i in gc]\n",
@ -150,15 +136,13 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"And finally export the data as GeoJson string and paste it online for easy visualization ong github:"
"And finally export the data as GeoJson string"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"data = geomcol.ExportToJson()"
@ -168,26 +152,38 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"To save on file the new dataset we will ```echo``` the ```geojson``` string to a file and then use the ```gist``` utility to upload the data online:"
"To save on file the new dataset we will ```echo``` the ```geojson``` string to a file"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"!echo '{data}' > /tmp/geojson.geojson"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The ```gist``` utility (not installed on the live) can be used to paste the content of a text file online as a *gist* for easy visualization on github"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"#!gist -p /tmp/geojson.geojson"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from CesiumWidget import CesiumWidget"
@ -196,9 +192,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"cesiumExample = CesiumWidget(width=\"100%\",geojson=data, enable_lighting=True)"
@ -207,9 +201,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"cesiumExample"
@ -225,7 +217,7 @@
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
"version": 2.0
},
"file_extension": ".py",
"mimetype": "text/x-python",

View File

@ -2,9 +2,7 @@
"cells": [
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"metadata": {},
"source": [
"<h1><center>[Notebooks](../) - [Access to Geospatial data](../Access to Geospatial data) - [Introduction ](../Access to Geospatial data/Introduction to Access to Geospatial data.ipynb)</center></h1>"
]
@ -15,7 +13,7 @@
"source": [
"# Access to Geospatial data\n",
"\n",
"In this set of notebook two of the most important opensource software libraries are introduced:\n",
"In this set of notebook two of the most important open source software libraries are introduced:\n",
"\n",
"* [GDAL](http://localhost/osgeolive/en/overview/gdal_overview.html) (Geospatial Data Abstraction Library) \n",
"* [OSSIM](http://localhost/osgeolive/en/overview/ossim_overview.html) (Open Source Software Image Mapping). \n",
@ -43,7 +41,7 @@
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
"version": 2.0
},
"file_extension": ".py",
"mimetype": "text/x-python",
@ -55,4 +53,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}

View File

@ -16,7 +16,7 @@
"\n",
"## Core Programs\n",
"\n",
"* [```ossim-info```](#ossim-info) Used to run ossim utilities function and to display metadata for imagery, maps, terrain, and vector data.\n",
"* [```ossim-info```](#ossim-info) Used to run ossim utility function and to display metadata for imagery, maps, terrain, and vector data.\n",
" * [Utility functions](#Utility-functions)\n",
" * [radians from degrees](#radians-from-degrees)\n",
" * [degrees from radians](#degrees-from-radians)\n",
@ -47,10 +47,10 @@
"* [```ossim-img2rr```](#ossim-img2rr) Create reduced resolution data sets for an image.\n",
"* [```ossim-cmm```](#ossim-cmm) Determine the min/max pixel values of an image.\n",
"* [```ossim-create-histo```](#ossim-create-histo) Compute a histogram for an image.\n",
"* [```ossim-img2md```](#ossim-img2md) Create meta data files.\n",
"* [```ossim-img2md```](#ossim-img2md) Create metadata files.\n",
"* [```ossim-tfw2ogeom```]() Create a geom file from a TIFF World File.\n",
"* [```ossim-extract-vertices```]() Compute the valid vertices (corners) of an image.\n",
"* [```ossim-preproc```]() Create reduced resolution data sets, histograms, and so on. Application does directory walking and is threaded at a file level.\n",
"* [```ossim-preproc```]() Create reduced resolution data sets, histograms, and so on. The application does directory walking and is threaded at a file level.\n",
"* [```ossim-applanix2ogeom```]() Create a geom file for Applanix Images.\n",
"* [```ossim-create-cg```]() Create an ossim coarse grid.\n",
"* [```ossim-ecg2ocg```]() Convert an enhanced coarse grid to an ossim coarse grid.\n",
@ -64,7 +64,7 @@
"source": [
"## OSSIM-Applications\n",
"\n",
" * [```ossim-band-merge```](#ossim-band-merge) Merge multiple image files into a single n-band dataset.\n",
" * [```ossim-band-merge```](#ossim-band-merge) Merge multiple images files into a single n-band dataset.\n",
" * [```ossim-chipper```](#ossim-chipper) Render elevation data (e.g. shaded relief).\n",
" * [```ossim-icp```](#ossim-icp) Convert an image from one format to another.\n",
" * [```ossim-igen```](#ossim-igen) Execute image chains specified in a spec file.\n",
@ -82,9 +82,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"from IPython.core.display import Image"
@ -100,9 +98,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"DATADIR='/home/user/data/landsat/'\n",
@ -112,13 +108,11 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"# we'll use the north_carolina image dataset\n",
"!ls {DATADIR} | grep tif "
"!ls {DATADIR} | grep tif"
]
},
{
@ -133,9 +127,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"!ossim-info"
@ -160,10 +152,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false,
"scrolled": true
},
"metadata": {},
"outputs": [],
"source": [
"!ossim-info --deg2rad 20.54"
@ -187,9 +176,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!ossim-info --rad2deg 0.35849"
@ -215,9 +202,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!ossim-info --ft2mtrs 1"
@ -235,9 +220,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!ossim-info --ft2mtrs-us-survey 1"
@ -263,9 +246,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!ossim-info --mtrs2ft 1"
@ -283,9 +264,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!ossim-info --mtrs2ft-us-survey 1"
@ -311,9 +290,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"# note we pass the path to the ossim_preference file to tell where the geoid file is\n",
@ -339,9 +316,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!ossim-info --mtrsPerDeg 65.45"
@ -366,9 +341,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"!ossim-info --datums"
@ -386,10 +359,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false,
"scrolled": true
},
"metadata": {},
"outputs": [],
"source": [
"!ossim-info --projections"
@ -421,9 +391,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!ossim-info --cg {DATADIR}/clip10.tif -P /usr/share/ossim/ossim_preference"
@ -448,9 +416,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!ossim-info --ci {DATADIR}/clip10.tif -P /usr/share/ossim/ossim_preference"
@ -475,9 +441,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!ossim-info -c {DATADIR}/clip10.tif -P /usr/share/ossim/ossim_preference"
@ -502,9 +466,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!ossim-info -i {DATADIR}/clip10.tif -P /usr/local/share/ossim/ossim_preference"
@ -529,9 +491,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!ossim-info -m {DATADIR}/clip10.tif -P /usr/share/ossim/ossim_preference"
@ -556,9 +516,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"!ossim-info -p {DATADIR}/clip10.tif -P /usr/share/ossim/ossim_preference"
@ -583,9 +541,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!ossim-info -r {DATADIR}/clip10.tif -P /usr/share/ossim/ossim_preference"
@ -608,9 +564,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!ossim-img2rr {DATADIR}/clip10.tif -P /usr/share/ossim/ossim_preference"
@ -619,9 +573,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!ossim-img2rr {DATADIR}/clip20.tif -P /usr/share/ossim/ossim_preference"
@ -630,9 +582,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!ossim-img2rr {DATADIR}/clip30.tif -P /usr/share/ossim/ossim_preference"
@ -648,9 +598,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!ossim-cmm {DATADIR}/clip10.tif -P /usr/share/ossim/ossim_preference"
@ -659,9 +607,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!ossim-cmm {DATADIR}/clip20.tif -P /usr/share/ossim/ossim_preference"
@ -670,9 +616,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!ossim-cmm {DATADIR}/clip30.tif -P /usr/share/ossim/ossim_preference"
@ -681,9 +625,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!cat {DATADIR}clip10.omd"
@ -712,20 +654,16 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!ossim-img2md -P /usr/share/ossim/ossim_preference tiff_world_file {DATADIR}/clip10.tif {DATADIR}/clip10.tfw "
"!ossim-img2md -P /usr/share/ossim/ossim_preference tiff_world_file {DATADIR}/clip10.tif {DATADIR}/clip10.tfw"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!cat {DATADIR}/clip10.tfw"
@ -744,15 +682,13 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Example, crete an RGB image from the single-band grayscale r,g,b images (Landsat 7)"
"Example, create an RGB image from the single-band grayscale r,g,b images (Landsat 7)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!ossim-band-merge jpeg -P /usr/share/ossim/ossim_preference \\\n",
@ -765,9 +701,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!ossim-cmm {OUTPUTDIR}/rgb.jpeg -P /usr/share/ossim/ossim_preference"
@ -776,9 +710,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!cat {OUTPUTDIR}/rgb.omd"
@ -787,9 +719,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"Image(OUTPUTDIR+\"rgb.jpeg\")"
@ -812,9 +742,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!ossim-create-histo {DATADIR}/clip30.tif \\\n",
@ -825,9 +753,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!ossim-orthoigen --hist-auto-minmax {DATADIR}/clip30.tif {OUTPUTDIR}/clip30_histmm.tif -P /usr/share/ossim/ossim_preference\n",
@ -838,9 +764,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!ossim-band-merge jpeg -P /usr/share/ossim/ossim_preference \\\n",
@ -853,9 +777,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"Image(OUTPUTDIR+'rgb_histmm.jpeg')"
@ -871,9 +793,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!wget https://gist.githubusercontent.com/anonymous/c339de8d38357a4a71bf/raw/428e9f193d29b25735b57960372d029691511a17/a.rb"
@ -882,9 +802,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!ossim-chipper --color 255 255 255 \\\n",
@ -900,9 +818,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"Image(OUTPUTDIR+'hillshade.jpg')"
@ -927,9 +843,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"# A complete list of ossim writers (driver) is given by:\n",
@ -939,9 +853,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"#convert a geotiff to a geopdf\n",
@ -951,9 +863,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"#view the results in a pdf viewer\n",
@ -975,30 +885,25 @@
"\n",
"Execute image chains specified in a spec file.\n",
"\n",
"In the folowing example the spec file ```rgb.spec``` has been generated using [imagelinker](http://localhost/osgeolive/en/quickstart/ossim_quickstart.html), from an example session: ```/home/user/ossim/ossim-rgb.prj```"
"In the folowing example the spec file ```rgb.spec``` has been generated using [imagelinker](http://localhost/osgeolive/en/quickstart/ossim_quickstart.html) ```save spec only``` when saving a data product (this may be useful when batch processing a complex image chain, or when ossim is built with mpi support to redistribute the computation on more CPU's)."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false,
"scrolled": true
},
"metadata": {},
"outputs": [],
"source": [
"#ossim-igen /home/user/ossim/rgb.spec"
"!ossim-igen /home/user/data/landsat/rgb.spec"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"#display < /home/user/rgb.jpg"
"Image(\"/home/user/data/landsat/rgb_spec.jpg\")"
]
},
{
@ -1043,7 +948,7 @@
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
"version": 2.0
},
"file_extension": ".py",
"mimetype": "text/x-python",
@ -1055,4 +960,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}

View File

@ -17,9 +17,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"import psycopg2\n",
@ -30,9 +28,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"curs = conn.cursor()\n",
@ -45,24 +41,20 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"curs = conn.cursor()\n",
"curs.execute(\"Select * FROM ne_10m_urban_areas\")\n",
"colnames = [desc[0] for desc in curs.description]\n",
"conn.commit()\n",
"colnames\n"
"colnames"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"curs = conn.cursor()\n",
@ -73,9 +65,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"table='cities'\n",
@ -88,9 +78,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"querytmplate=\"INSERT INTO %(table)s (%(col)s) VALUES (1,ST_GeomFromText('POINT(%(x)f %(y)f)',4326),'%(name)s');\""
@ -99,9 +87,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"querytmplate = querytmplate % {'table':table, 'col':col, 'x':x, 'y':x, 'name':name}"
@ -110,9 +96,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"curs = conn.cursor()\n",
@ -123,9 +107,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"curs = conn.cursor()\n",
@ -138,9 +120,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"curs = conn.cursor()\n",
@ -153,9 +133,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"data[0][1]"
@ -164,11 +142,11 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": []
"source": [
""
]
}
],
"metadata": {
@ -180,7 +158,7 @@
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
"version": 2.0
},
"file_extension": ".py",
"mimetype": "text/x-python",
@ -192,4 +170,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}

View File

@ -9,9 +9,7 @@
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"metadata": {},
"source": [
"* [Intro to Postgis](Intro to Postgis.ipynb)"
]
@ -26,7 +24,7 @@
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
"version": 2.0
},
"file_extension": ".py",
"mimetype": "text/x-python",
@ -38,4 +36,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}

View File

@ -11,7 +11,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"In this set of notebooks the GRASS enviroenment variables have benn already exported, so to have GRASS functionalities accessible."
"On the OSGeoLive, the Jupyter notebook is started by a bash script which has instructions to export the GRASS environment variables. In this way the GRASS functionalities are accessible from within the notebooks using the system command magic which consists in adding an exclamation mark as prefix to a bash command, e.g.: ```!bash-command``` "
]
},
{
@ -24,9 +24,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"import grass.script as grass"
@ -45,15 +43,13 @@
"source": [
"## [g.gisenv](http://localhost/grass/g.gisenv.html)\n",
"\n",
"When a user runs GRASS, certain variables are set specifying the GRASS data base, location, mapset, peripheral device drivers, etc., being used in the current GRASS session. These variable name settings are recognized as long as the user is running a GRASS session. "
"When a user runs GRASS, certain variables are set specifying the GRASS database, location, mapset, peripheral device drivers, etc., being used in the current GRASS session. These variable name settings are recognized as long as the user is running a GRASS session. "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!g.gisenv"
@ -72,15 +68,13 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Generate a new GRASS LOCATION Specifying the projection parameters using the proj-4 string syntax (information retrieved from the gdalinfo output) using [g.proj](http://localhost/grass/g.proj.html)\n"
"Generate a new GRASS LOCATION Specifying the projection parameters using the proj-4 string syntax using [g.proj](http://localhost/grass/g.proj.html). The informations used as input to ```g.proj``` are retrieved from the gdalinfo output.\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!gdalinfo /usr/local/share/data/north_carolina/rast_geotiff/basin_50K.tif"
@ -89,9 +83,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"proj4 = '+proj=lcc +lat_1=36.1667 +lat_2=34.333 +lat_0=33.75 +lon_0=-79 +x_0=609601.22 +y_0=0 +no_defs +a=6378137 +rf=298.2572221010042 +to_meter=1'\n",
@ -105,9 +97,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!g.mapset location=nc mapset=PERMANENT"
@ -116,9 +106,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!g.proj -p"
@ -134,7 +122,7 @@
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
"version": 2.0
},
"file_extension": ".py",
"mimetype": "text/x-python",
@ -146,4 +134,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}

View File

@ -9,9 +9,7 @@
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"metadata": {},
"source": [
"# Introduction to GRASS GIS\n",
"\n",
@ -32,7 +30,7 @@
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
"version": 2.0
},
"file_extension": ".py",
"mimetype": "text/x-python",
@ -44,4 +42,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}

View File

@ -10,9 +10,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"%run grassutil.ipy"
@ -21,9 +19,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"DATADIR='/home/user/data/north_carolina/rast_geotiff/'"
@ -32,9 +28,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!g.mapset location=nc mapset=PERMANENT"
@ -43,9 +37,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!g.proj -p"
@ -54,9 +46,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!r.in.gdal input={DATADIR}/elevation.tif output=elevation -e --o"
@ -65,9 +55,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"makeImage(basemap='elevation', inputlayer='elevation', maptype='raster', \n",
@ -77,20 +65,16 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!r.in.gdal input={DATADIR}/basin_50K.tif output=basin_50K -e --o "
"!r.in.gdal input={DATADIR}/basin_50K.tif output=basin_50K -e --o"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"makeImage(basemap='basin_50K', inputlayer='basin_50K', maptype='raster', \n",
@ -100,9 +84,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"!r.blend first=elevation second=basin_50K output=basin_relief percent=30 --overwrite --quiet"
@ -111,9 +93,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"makeImage(basemap='basin_50K', inputlayer='basin_relief', maptype='rgb', \n",
@ -123,9 +103,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"!m.nviz.image elevation_map=elevation output=elevation position=0.5,0.5 \\\n",
@ -136,9 +114,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"!convert elevation.tif elevation.png\n",
@ -148,11 +124,11 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": []
"source": [
""
]
}
],
"metadata": {
@ -164,7 +140,7 @@
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
"version": 2.0
},
"file_extension": ".py",
"mimetype": "text/x-python",
@ -176,4 +152,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}

View File

@ -62,7 +62,7 @@
"\n",
"**[Simple web-gis products](Simple web-gis products/Introduction to Simple web-gis products.ipynb)**\n",
"\n",
" * [CESIUM]()\n",
" * [CESIUM](Simple web-gis products/CESIUM/cesium-introduction.ipynb)\n",
"\n",
"\n"
]
@ -70,11 +70,11 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": []
"source": [
""
]
}
],
"metadata": {
@ -86,7 +86,7 @@
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
"version": 2.0
},
"file_extension": ".py",
"mimetype": "text/x-python",
@ -98,4 +98,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}

View File

@ -11,7 +11,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# An intro to Numerical Cartography"
"# An introduction to Numerical Cartography"
]
},
{
@ -46,7 +46,7 @@
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
"version": 2.0
},
"file_extension": ".py",
"mimetype": "text/x-python",
@ -58,4 +58,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}

View File

@ -3,9 +3,7 @@
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"name": "stdout",
@ -24,9 +22,7 @@
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
@ -36,9 +32,7 @@
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
@ -66,16 +60,10 @@
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Latitude Longitude\n",
"0 30.263889 45.563456\n",
"1 23.457654 34.433425"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result",
"metadata": {}
}
],
"source": [
@ -86,9 +74,7 @@
{
"cell_type": "code",
"execution_count": 49,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"def d2s(df,key='Latitude'):\n",
@ -111,9 +97,7 @@
{
"cell_type": "code",
"execution_count": 39,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"Lat = d2s(df=input,key='Latitude')\n",
@ -123,9 +107,7 @@
{
"cell_type": "code",
"execution_count": 40,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
@ -156,16 +138,10 @@
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Degree Minute Second\n",
"0 30 15 50.0000\n",
"1 23 27 27.5544"
]
},
"execution_count": 40,
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result",
"metadata": {}
}
],
"source": [
@ -175,9 +151,7 @@
{
"cell_type": "code",
"execution_count": 44,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
@ -208,28 +182,20 @@
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Degree Minute Second\n",
"0 45 33 48.4416\n",
"1 34 26 0.3300"
]
},
"execution_count": 44,
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result",
"metadata": {}
}
],
"source": [
"Lon "
"Lon"
]
},
{
"cell_type": "code",
"execution_count": 45,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
@ -238,8 +204,8 @@
]
},
"execution_count": 45,
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result",
"metadata": {}
}
],
"source": [
@ -249,9 +215,7 @@
{
"cell_type": "code",
"execution_count": 46,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
@ -260,8 +224,8 @@
]
},
"execution_count": 46,
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result",
"metadata": {}
}
],
"source": [
@ -271,11 +235,11 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": []
"source": [
""
]
}
],
"metadata": {
@ -287,7 +251,7 @@
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
"version": 3.0
},
"file_extension": ".py",
"mimetype": "text/x-python",
@ -299,4 +263,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}

View File

@ -20,13 +20,13 @@
"\n",
"The characteristics normally considered in choosing a map projection are as follows:\n",
"\n",
"* **Area** - (eg. equal-area map) on such maps the area is preserved (areas of same size on the map represent an area f equivalent size on the earth) Shapes, angles, and scale must be distorted on most parts of such a map. Equal-area map are also called *equivalent*, *homolographic*, or *homalographic*\n",
"* **Shape** - (eg. conformal map) on those map the relative local angles about every point on the map are shown correctly. Because local angles are correct, meridians intersect parallels at right ($90^\\circ$) angles on a conformal projection.\n",
"* **Scale** (eg. quidistant projections) No map projection shows scale correctly throughout the map, but there are usually one or more lines on the map along which the scale remains true. An equidistant projection show true scale between one or two points and every other point on the map, or along every meridian.\n",
"* **Direction** - While conformal maps give the relative local directions cor- rectly at any given point, there is one frequently used group of map projections, called azimuthal (or zenithal), on which the directions or azimuths of all points on the map are shown correctly with respect to the center. Some projection of this kind can be *equal-area* others can be *conformal* or *equidistant* \n",
"* **Special characteristic** - Several map projections provide specialcharacteristics that no other projection provides. eg. On the *Mercator projection* the lines of constant direction (rhumb lines) are shown as straight lines. On the *Gnomonic projection*, all great circle paths are shown as straight lines. On the *Stereographic*, all small circles, as well as great circles, are shown as circles on the map. \n",
"* **Area** - (eg. equal-area map) on such maps the area is preserved (areas of the same size on the map represent an area f equivalent size on the earth) Shapes, angles, and scale must be distorted in most parts of such a map. Equal-area map is also called *equivalent*, *homolographic*, or *homalographic*\n",
"* **Shape** - (eg. conformal map) on those maps the relative local angles about every point on the map are shown correctly. Because local angles are correct, meridians intersect parallels at right ($90^\\circ$) angles on a conformal projection.\n",
"* **Scale** (eg. equidistant projections) No map projection shows scale correctly throughout the map, but there are usually one or more lines on the map along which the scale remains true. An equidistant projection shows true scale between one or two points and every other point on the map, or along every meridian.\n",
"* **Direction** - While conformal maps give the relative local directions correctly at any given point, there is one frequently used group of map projections, called azimuthal (or zenithal), on which the directions or azimuths of all points on the map are shown correctly with respect to the center. Some projection of this kind can be *equal-area* others can be *conformal* or *equidistant* \n",
"* **Special characteristic** - Several map projections provide special characteristics that no other projection provides. eg. On the *Mercator projection*, the lines of constant direction (rhumb lines) are shown as straight lines. On the *Gnomonic projection*, all great circle paths are shown as straight lines. On the *Stereographic*, all small circles, as well as great circles, are shown as circles on the map. \n",
"\n",
"source : [Map Projections](http://pubs.usgs.gov/pp/1395/report.pdf)"
"Source: [Map Projections](http://pubs.usgs.gov/pp/1395/report.pdf)"
]
},
{
@ -38,9 +38,7 @@
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"metadata": {},
"source": [
"---\n",
"\n",
@ -57,7 +55,7 @@
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
"version": 2.0
},
"file_extension": ".py",
"mimetype": "text/x-python",
@ -69,4 +67,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}

View File

@ -13,7 +13,7 @@
"source": [
"# Spatial and Coordinate Reference System\n",
"\n",
"A **spatial reference system** (SRS) or **coordinate reference system** (CRS) is a [coordinate-based](https://en.wikipedia.org/wiki/Coordinate_system) local, regional or global system used to locate geographical entities. A spatial reference system defines a specific [map projection](https://en.wikipedia.org/wiki/Map_projection), as well as transformations between different spatial reference systems. Spatial reference systems are defined by the [OGC](https://en.wikipedia.org/wiki/Open_Geospatial_Consortium)'s [Simple feature access](https://en.wikipedia.org/wiki/Simple_feature_access) using [well-known text](https://en.wikipedia.org/wiki/Well-known_text), and support has been implemented by several [standards-based](https://en.wikipedia.org/wiki/Technical_standard) [geographic information systems](https://en.wikipedia.org/wiki/Geographic_information_system). Spatial reference systems can be referred to using a [SRID](https://en.wikipedia.org/wiki/SRID) integer, including EPSG codes defined by the [International Association of Oil and Gas Producers](https://en.wikipedia.org/wiki/International_Association_of_Oil_and_Gas_Producers).\n",
"A **spatial reference system** (SRS) or **coordinate reference system** (CRS) is a [coordinate-based](https://en.wikipedia.org/wiki/Coordinate_system) local, regional or global system used to locate geographical entities. A spatial reference system defines a specific [map projection](https://en.wikipedia.org/wiki/Map_projection), as well as transformations between different spatial reference systems. Spatial reference systems are defined by the [OGC](https://en.wikipedia.org/wiki/Open_Geospatial_Consortium)'s [Simple feature access](https://en.wikipedia.org/wiki/Simple_feature_access) using [well-known text](https://en.wikipedia.org/wiki/Well-known_text), and support has been implemented by several [standards-based](https://en.wikipedia.org/wiki/Technical_standard) [geographic information systems](https://en.wikipedia.org/wiki/Geographic_information_system). Spatial reference systems can be referred to using an [SRID](https://en.wikipedia.org/wiki/SRID) integer, including EPSG codes defined by the [International Association of Oil and Gas Producers](https://en.wikipedia.org/wiki/International_Association_of_Oil_and_Gas_Producers).\n",
"\n",
"**source:** \n",
"\n",
@ -24,9 +24,7 @@
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"metadata": {},
"source": [
"## Coordinate Reference System (CRS):\n",
"A position refers to the spatial location of an entity and it is determined by its spatial coordinates relative to a spatial reference system (SRS).\n",
@ -35,7 +33,7 @@
"\n",
"### Geographic latitude and longitude:\n",
" \n",
" A geographic coordinate system is a coordinate system that enables every location on the Earth to be specified by a set of numbers or letters.A common choice of coordinates is latitude, longitude and elevation.\n",
" A geographic coordinate system is a coordinate system that enables every location on the Earth to be specified by a set of numbers or letters.A common choice of coordinates is latitude, longitude, and elevation.\n",
" \n",
" * **Latitude** (angle between the equatorial plane and the straight line that passes through that point and through, or close to, the center of the Earth)\n",
" * **Longitude** (the angle east or west from a reference meridian to another meridian that passes through that position). \n",
@ -51,7 +49,7 @@
"source": [
"### Universal Transverse Mercator (UTM) coordinate system:\n",
"\n",
" The UTM coordinate system use a metric-based cartesian grid laid out on a conformally projected surface. The UTM system is not a single map projection but a series of sixty, each covering 6-degree bands of longitude.\n",
" The UTM coordinate system uses a metric-based cartesian grid laid out on a conformally projected surface. The UTM system is not a single map projection but a series of sixty, each covering 6-degree bands of longitude.\n",
" \n",
" \n",
"<img src=\"../images/utmzone.svg\">"
@ -63,9 +61,9 @@
"source": [
"## Geodetic Coordinates:\n",
" \n",
" To completely specify a location of a topographical feature on, in, or above the Earth, one has to also specify the vertical distance from the centre of the Earth, or from the surface of the Earth.\n",
" To completely specify a location of a topographical feature on, in, or above the Earth, one has to also specify the vertical distance from the center of the Earth, or from the surface of the Earth.\n",
" \n",
" In order to be unambiguous about the direction of \"vertical\" and the \"surface\" above which they are measuring, map-makers choose a reference ellipsoid with a given origin and orientation that best fits their need for the area they are mapping. They then choose the most appropriate mapping of the spherical coordinate system onto that ellipsoid, called a terrestrial reference systemor geodetic datum. Datums may be global, meaning that they represent the whole earth, or they may be local, meaning that they represent a best-fit ellipsoid to only a portion of the earth.\n",
" In order to be unambiguous about the direction of \"vertical\" and the \"surface\" above which they are measuring, map-makers choose a reference ellipsoid with a given origin and orientation that best fits their need for the area they are mapping. They then choose the most appropriate mapping of the spherical coordinate system onto that ellipsoid, called a terrestrial reference system or geodetic datum. Datums may be global, meaning that they represent the whole earth, or they may be local, meaning that they represent a best-fit ellipsoid to only a portion of the earth.\n",
" \n",
" The choice of which layer to use for defining height is arbitrary. Common height baselines include:\n",
" * The surface of the datum ellipsoid, resulting in an ellipsoidal height\n",
@ -93,7 +91,7 @@
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
"version": 2.0
},
"file_extension": ".py",
"mimetype": "text/x-python",
@ -105,4 +103,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}

View File

@ -20,18 +20,18 @@
"source": [
"Is common practice in Geospatial data science to work with datasets collected at different epoch and or referenced to different reference systems. In this context, the transformation parameters needed to convert data accurately into a more up-to-date reference system are often missed or, when available, are valid for wide areas affecting the accuracy of the transformation. In this briefing notes a simplified approach to derive datum transformation parameters is introduced.\n",
"\n",
"A Datum transformations can be defined as a geometric transformations between two three-dimensional coordinate reference systems. A common method consist in apply a *linear transformation* in the three dimensional space (x,y,z).\n",
"A Datum transformations can be defined as a geometric transformation between two three-dimensional coordinate reference systems. A common method consists of applying a *linear transformation* in the three-dimensional space (x,y,z).\n",
"A general linear transformation of a vector $x$ to another vector $y$ takes the form\n",
"\n",
"$$y=Mx+t \\quad (1)$$\n",
"\n",
"Each element of the $y$ vector is a combination of the element of $x$ plus a translation or shift represented by an element of the $t$ vector. The matrix **M** is called *transformation matrix* and **t** is called *translation vector*. With **M** being square nonsingular, the inverse relation exist (eq. 2)\n",
"Each element of the $y$ vector is a combination of the element of $x$ plus a translation or shift represented by an element of the $t$ vector. The matrix **M** is called *transformation matrix* and **t** is called *translation vector*. With **M** being square nonsingular, the inverse relation exists (eq. 2)\n",
"\n",
"$$x = M^{-1}(y-t) \\quad (2)$$\n",
"\n",
"in which case is called *affine transformation*.\n",
"\n",
"Limited to the two- and three- dimensional space, six *elementary* transformations are identified, each representing a single effect. They are geometrically described as: *Translation, Uniform scale, Rotation, Reflection, Stretch (Nonuniform scale factors) and Skew (Shear)*. \n",
"Limited to the two- and three- dimensional space, six *elementary* transformations are identified, each representing a single effect. They are geometrically described as *Translation, Uniform scale, Rotation, Reflection, Stretch (Nonuniform scale factors) and Skew (Shear)*. \n",
"\n",
"<img src=\"../images/linear-transformation.svg\", width=\"80%\">\n",
"\n",
@ -133,7 +133,7 @@
"b = \\lambda \\sin \\alpha\n",
"$$\n",
"\n",
"The linear system (6) can be solved knowing at least two points in $(D_1,D_2)$ once estimated the four unknown parameters $(a,b,{x'}_0,{y'}_0)$ it is possible to derive the rotation angle $\\alpha$ and the scale factor $\\lambda$ by:\n",
"The linear system (6) can be solved knowing, at least, two points in $(D_1,D_2)$ once estimated the four unknown parameters $(a,b,{x'}_0,{y'}_0)$ it is possible to derive the rotation angle $\\alpha$ and the scale factor $\\lambda$ by:\n",
"\n",
"$$\n",
"\\left\\{ \n",
@ -171,7 +171,7 @@
"metadata": {},
"source": [
"Firs we need to generate a proper test dataset, to do so we'll use a combination of pyproj and numpy.\n",
"Staring from the data used in the [Working with coordinates - Datum-transformation](../numerical cartography/Working with coordinates.ipynb#Datum-transformation) example, we generate a series of 50 random points in two different DATUM :\n",
"Starting from the data used in the [Working with coordinates - Datum-transformation](../numerical cartography/Working with coordinates.ipynb#Datum-transformation) example, we generate a series of 50 random points in two different DATUM:\n",
"\n",
"* UTM zone 19, WGS84 ellipse, WGS84\n",
"* UTM zone 19, Clarke 1866, NAD27"
@ -180,9 +180,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"#import the pyproj and numpy library\n",
@ -221,9 +219,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"# now generate 2 dataframes to store the x,y,z coordinates in the two different DATUM \n",
@ -245,9 +241,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"d1"
@ -265,9 +259,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"d2"
@ -279,15 +271,13 @@
"source": [
"* testing dataset:\n",
"\n",
"We'll first select the first 10 points in both dataframe and use them to estimate the transformation parameters. Then we'll use the other 40 points in $d1$ as input for the transformation. Finally compare the results with the output of pyproj."
"We'll first select the first 10 points in both data frame and use them to estimate the transformation parameters. Then we'll use the other 40 points in $d1$ as input for the transformation. Finally, compare the results with the output of pyproj."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"#d1,d2 subsample\n",
@ -310,9 +300,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"from transform import conforme"
@ -321,9 +309,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"res_conforme = conforme(gcpD1='d1s.csv', gcpD2='d2s.csv', knowD1='d.csv', output='conforme.csv')\n",
@ -340,9 +326,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"from transform import affine"
@ -351,9 +335,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"res_affine = affine(gcpD1='d1s.csv', gcpD2='d2s.csv', knowD1='d.csv', output='affine.csv')\n",
@ -370,9 +352,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"from transform import helmert"
@ -381,9 +361,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"res_helmert = helmert(gcp1='d1s.csv', gcp2='d2s.csv', inputf='d.csv', output='helmert.txt')\n",
@ -393,9 +371,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"d2[11:][['x','y']]"
@ -404,9 +380,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"delta_conforme = (d2[11:]['x'].values - res_conforme[:,0], d2[11:]['y'].values - res_conforme[:,1])\n",
@ -416,9 +390,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"delta_affine = (d2[11:]['x'].values - res_affine[:,0], d2[11:]['y'].values - res_affine[:,1])\n",
@ -428,9 +400,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"delta_helmert = (d2[11:]['x'].values - res_helmert[:,0], d2[11:]['y'].values - res_helmert[:,1])\n",
@ -465,7 +435,7 @@
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
"version": 2.0
},
"file_extension": ".py",
"mimetype": "text/x-python",
@ -477,4 +447,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}

View File

@ -1,4 +1,7 @@
###OSGeo-live###
[logo]: http://live.osgeo.org/_images/banner.png "OSGeoLive"
This directory hosts a set of **[IPython Notebooks](http://ipython.org/notebook.html)** that demonstrate the *Open Source Geospatial Tools* capabilities on **[OSGeo-live](http://live.osgeo.org/en/index.html)**.
To start the *Jupyter Notebook* server on *OSGeo-Live*, use the *GEOSPATIAL* menu item *start Jupyter Notebook*.

View File

@ -0,0 +1,480 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Running the Notebook Server"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The IPython notebook server is a custom web server that runs the notebook web application. Most of the time, users run the notebook server on their local computer using IPython's command line interface."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Starting the notebook server using the command line"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You can start the notebook server from the command line (Terminal on Mac/Linux, CMD prompt on Windows) by running the following command: \n",
"\n",
" ipython notebook\n",
"\n",
"This will print some information about the notebook server in your terminal, including the URL of the web application (by default, `http://127.0.0.1:8888`). It will then open your default web browser to this URL.\n",
"\n",
"When the notebook opens, you will see the **notebook dashboard**, which will show a list of the notebooks and subdirectories in the directory where the notebook server was started. As of IPython 2.0, the dashboard allows you to navigate to different subdirectories. Because of this, it is no longer necessary to start a separate notebook server for each subdirectory. Most of the time, you will want to start a notebook server in the highest directory in your filesystem where notebooks can be found. Often this will be your home directory.\n",
"\n",
"You can start more than one notebook server at the same time. By default, the first notebook server starts on port 8888 and later notebook servers search for open ports near that one.\n",
"\n",
"You can also specify the port manually:\n",
"\n",
" ipython notebook --port 9999\n",
"\n",
"Or start notebook server without opening a web browser.\n",
"\n",
" ipython notebook --no-browser\n",
"\n",
"The notebook server has a number of other command line arguments that can be displayed with the `--help` flag: \n",
"\n",
" ipython notebook --help\n",
"\n",
"<div class=\"alert alert-failure\">\n",
"It used to be possible to specify kernel options, such as <code>--pylab inline</code> from the command line. This is deprecated in IPython 2.0 and will be removed in IPython 3.0. To enable matplotlib based plotting for the Python kernel use the <code>%matplotlib</code> magic command.\n",
"</div>\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Configuring the IPython Notebook"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The notebook web server can also be configured using IPython profiles and configuration files. The Notebook web server configuration options are set in a file named `ipython_notebook_config.py` in your IPython *profile directory*. The profile directory is a subfolder of your IPython directory, which itself is usually `.ipython` in your home directory.\n",
"\n",
"You can display the location of your default profile directory by running the command:"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"/Users/bgranger/.ipython/profile_default\r\n"
]
}
],
"source": [
"!ipython profile locate default"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The default version of `ipython_notebook_config.py` lists all of the options available along with documentation for each. Changes made to that file will affect all notebook servers run under that profile. Command line options always override those set in configuration files.\n",
"\n",
"You can create a new profile:"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[ProfileCreate] Generating default config file: u'/Users/bgranger/.ipython/profile_my_profile/ipython_config.py'\r\n",
"[ProfileCreate] Generating default config file: u'/Users/bgranger/.ipython/profile_my_profile/ipython_qtconsole_config.py'\r\n",
"[ProfileCreate] Generating default config file: u'/Users/bgranger/.ipython/profile_my_profile/ipython_notebook_config.py'\r\n",
"[ProfileCreate] Generating default config file: u'/Users/bgranger/.ipython/profile_my_profile/ipython_nbconvert_config.py'\r\n"
]
}
],
"source": [
"!ipython profile create my_profile"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"And then view its location:"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"/Users/bgranger/.ipython/profile_my_profile\r\n"
]
}
],
"source": [
"!ipython profile locate my_profile"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"To start the notebook server using a given profile, run the following:\n",
"\n",
" ipython notebook --profile=my_profile"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"More details about IPython configuration files and profiles can be found [here](http://ipython.org/ipython-doc/dev/config/intro.html)."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Securing the notebook server"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The IPython Notebook allows arbitrary code execution on the computer running it. Thus, the notebook web server should never be run on the open internet without first securing it. By default, the notebook server only listens on local network interface (`127.0.0.1`) There are two steps required to secure the notebook server:\n",
"\n",
"1. Setting a password\n",
"2. Encrypt network traffic using SSL"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Setting a password"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You can protect your notebook server with a simple single password by setting the `NotebookApp.password` configurable. You can prepare a hashed password using the function `IPython.lib.passwd`:"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"'sha1:6c2164fc2b22:ed55ecf07fc0f985ab46561483c0e888e8964ae6'"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from IPython.lib import passwd\n",
"password = passwd(\"secret\")\n",
"password"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You can then add this to your `ipython_notebook_config.py`:\n",
"\n",
"```python\n",
"# Password to use for web authentication\n",
"c = get_config()\n",
"c.NotebookApp.password = \n",
"u'sha1:6c2164fc2b22:ed55ecf07fc0f985ab46561483c0e888e8964ae6'\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Using SSL/HTTPS"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"When using a password, it is a good idea to also use SSL, so that your \n",
"password is not sent unencrypted by your browser to the web server. When running the notebook on the public internet this is absolutely required.\n",
"\n",
"The first step is to generate an SSL certificate. A self-signed certificate can be generated with ``openssl``. For example, the following command will create a certificate valid for 365 days with both the key and certificate data written to the same file:\n",
"\n",
" openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mycert.pem -out mycert.pem\n",
"\n",
"In most cases, you should run this command in your profile directory, which will make it easy to use the generated key and certificate.\n",
"\n",
"When you connect to a notebook server over HTTPS using a self-signed certificate, your browser will warn you of a dangerous certificate because it is self-signed. If you want to have a fully compliant certificate that will not raise warnings, it is possible (but rather involved) to obtain one,\n",
"as explained in detail in [this tutorial](http://arstechnica.com/security/news/2009/12/how-to-get-set-with-a-secure-sertificate-for-free.ars)\n",
"\t\n",
"When you enable SSL support, you will need to access the notebook server over ``https://``, rather than plain ``http://``. The startup message from the notebook server prints the correct URL, but it is easy to overlook and think the server is for some reason non-responsive.\n",
"\n",
"Once you have generated the key and certificate, you can configure the notebook server to use them, by adding the following to `ipython_notebook_config.py`:\n",
"\n",
"```python\n",
"# The full path to an SSL/TLS certificate file.\n",
"c.NotebookApp.certfile = u'/Users/bgranger/.ipython/profile_my_profile/mycert.crt'\n",
"\n",
"# The full path to a private key file for usage with SSL/TLS.\n",
"c.NotebookApp.keyfile = u'/Users/bgranger/.ipython/profile_my_profile/mycert.key'\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Running a public notebook server"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<div class=\"alert alert-error\">\n",
"Don't run a public notebook server unless you first secure it with a password and SSL/HTTPS as described above\n",
"</div>\n",
"\n",
"By default the notebook server only listens on the `localhost/127.0.0.1` network interface. If you want to connect to the notebook from another computers, or over the internet, you need to configure the notebook server to listen on all network interfaces and not open the browser. You will often also want to disable the automatic launching of the web browser.\n",
"\n",
"This can be accomplished by passing a command line options.\n",
"\n",
" ipython notebook --ip=* --no-browser\n",
"\n",
"You can also add the following to your`ipython_notebook_config.py` file:\n",
"\n",
"```python\n",
"c.NotebookApp.ip = '*'\n",
"c.NotebookApp.open_browser = False\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Running with a different URL prefix"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The notebook dashboard typically lives at the URL `http://localhost:8888/tree`. If you prefer that it lives, together with the \n",
"rest of the notebook web application, under a base URL prefix, such as `http://localhost:8888/ipython/tree`, you can do so by adding the following lines to your `ipython_notebook_config.py` file.\n",
"\n",
"```python\n",
"c.NotebookApp.base_url = '/ipython/'\n",
"c.NotebookApp.webapp_settings = {'static_url_prefix':'/ipython/static/'}\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Known issues"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"When behind a proxy, especially if your system or browser is set to autodetect the proxy, the notebook web application might fail to connect to the server's websockets, and present you with a warning at startup. In this case, you need to configure your system not to use the proxy for the server's address.\n",
"\n",
"For example, in Firefox, go to the Preferences panel, Advanced section,\n",
"Network tab, click 'Settings...', and add the address of the notebook server\n",
"to the 'No proxy for' field."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Using a different notebook store"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"By default, the notebook server stores the notebook documents that it saves as files in the working directory of the notebook server, also known as the\n",
"`notebook_dir`. This logic is implemented in the `FileNotebookManager` class. However, the server can be configured to use a different notebook manager class, which can store the notebooks in a different format. \n",
"\n",
"The [bookstore](https://github.com/rgbkrk/bookstore) package currently allows users to store notebooks on Rackspace CloudFiles or OpenStack Swift based object stores.\n",
"\n",
"Writing a notebook manager is as simple as extending the base class `NotebookManager`. The [simple_notebook_manager](https://github.com/khinsen/simple_notebook_manager) provides a great example\n",
"of an in memory notebook manager, created solely for the purpose of\n",
"illustrating the notebook manager API."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Multi-User Notebook Servers"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## JupyterHub"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"JupyterHub is a multi-user server that manages and proxies multiple instances of the single-user IPython/Jupyter Notebook server.\n",
"\n",
"<img src=\"https://c2a32ff18d23c8f567f0-e44b0df73868b5d567b1e58e01681d15.ssl.cf5.rackcdn.com/2015-03-24-deploying-jupyterhub-for-education/jupyterhub-9efc59baf33d2640641cb4a1fd9145ff.gif\" width=\"800px\" />\n",
"\n",
"### Components\n",
"\n",
"* multi-user Hub (tornado process)\n",
"* configurable http proxy (node-http-proxy)\n",
"* multiple single-user IPython notebook servers (Python/IPython/tornado)\n",
"\n",
"#### [Configurable Proxy](https://github.com/jupyter/configurable-http-proxy)\n",
"\n",
"* Based on node-http-proxy\n",
"* Proxy routes to localhost, external IPs, etc.\n",
"\n",
"```\n",
"/user/123/ -> 127.0.0.1:56790\n",
"```\n",
"\n",
"* Provides an administrative API for adding routes\n",
"\n",
"```\n",
"POST /api/routes/[:path]\n",
"```\n",
"\n",
"#### [JupyterHub](https://github.com/jupyter/jupyterhub)\n",
"\n",
"* Hub spawns proxy\n",
"* Proxy forwards ~all requests to hub by default\n",
"* Hub handles login, and spawns single-user servers on demand\n",
"* Hub configures proxy to forward url prefixes to single-user servers\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Authentication models\n",
"\n",
"* PAM/Unix (Default)\n",
"* [GitHub OAuth](https://github.com/jupyter/oauthenticator) - Demo at demohub.jupyter.org\n",
"\n",
"This is extensible enough to implement other authentication methods, the simplest being any involving OAuth (follow the GitHub OAuthenticator for a skeleton)."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Spawners\n",
"\n",
"By default, notebook servers are spawned in the context of the user as a process on the host machine. One alternative for spawning is the [DockerSpawner](https://github.com/jupyter/dockerspawner) which runs each user in their own environment inside a Docker container.\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Real world implementations of JupyterHub\n",
"\n",
"The Computational Models class at UC Berkeley ran a JupyterHub installation for ~220 students in Winter/Spring of 2015.\n",
"\n",
"* Docker Spawner\n",
"* Multiple compute nodes\n",
"* GitHub Authentication\n",
"* NFS backed for student data, assignments, notebooks, etc.\n",
"\n",
"![](https://c2a32ff18d23c8f567f0-e44b0df73868b5d567b1e58e01681d15.ssl.cf5.rackcdn.com/2015-03-24-deploying-jupyterhub-for-education/setup-2e74d935ee0c874e66a9b53359493ceb.png)\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## tmpnb\n",
"\n",
"tmpnb is a temporary notebook system. Visit [try.jupyter.org](https://try.jupyter.org) for a demo.\n",
"\n",
"Similar to JupyterHub with the DockerSpawner, tmpnb uses a proxy to route to notebook servers. The difference is that there is no login and notebook servers get deleted after a period of (configurable) inactivity.\n",
"\n",
"<img src=\"https://cloud.githubusercontent.com/assets/836375/5911140/c53e3978-a587-11e4-86a5-695469ef23a5.png\" width=\"800px\" />\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.4.3"
}
},
"nbformat": 4,
"nbformat_minor": 0
}

View File

@ -4,7 +4,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"#OSGeo-live-Notebooks\n",
"# OSGeo-live-Notebooks\n",
"\n",
"This directory host a set of **[IPython Notebook](http://ipython.org/notebook.html)** that are used in the **[OSGeo-live](http://live.osgeo.org/en/index.html)** project to demostrate the capabilities of *Open Source Geospatial Tools* installed on the *OSGeo-Live*.\n",
"To start the *Jupyter Notebook* server on the *OSGeo-Live*, use the *GEOSPATIAL* menu *start Jupyter Notebook*. \n",
@ -32,7 +32,7 @@
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
"version": 2.0
},
"file_extension": ".py",
"mimetype": "text/x-python",
@ -44,11 +44,11 @@
"latex_envs": {
"bibliofile": "biblio.bib",
"cite_by": "apalike",
"current_citInitial": 1,
"current_citInitial": 1.0,
"eqLabelWithNumbers": true,
"eqNumInitial": 0
"eqNumInitial": 0.0
}
},
"nbformat": 4,
"nbformat_minor": 0
}
}

View File

@ -243,7 +243,7 @@
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
"version": 3.0
},
"file_extension": ".py",
"mimetype": "text/x-python",
@ -255,4 +255,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}

View File

@ -0,0 +1,142 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Beautifully simple maps\n",
"Cartopy has exposed an interface to enable easy map creation using matplotlib. Creating a basic map is as simple as telling matplotlib to use a specific map projection, and then adding some coastlines to the axes:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib inline\n",
"import cartopy.crs as ccrs\n",
"import matplotlib.pyplot as plt\n",
"\n",
"plt.figure(figsize=(12, 12))\n",
"ax = plt.axes(projection=ccrs.PlateCarree())\n",
"ax.coastlines();"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"A list of the available projections to be used with matplotlib can be found on the [Cartopy projection list notebook](01 CARTOPY-projections.ipynb).\n",
"\n",
"The line ```plt.axes(projection=ccrs.PlateCarree())``` sets up a GeoAxes instance which exposes a variety of other map related methods, in the case of the previous example, we used the ```coastlines()``` method to add coastlines to the map.\n",
"\n",
"Lets create another map in a different projection, and make use of the ```stock_img()``` method to add an underlay image to the map:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import cartopy.crs as ccrs\n",
"import matplotlib.pyplot as plt\n",
"\n",
"\n",
"plt.figure(figsize=(12, 12))\n",
"ax = plt.axes(projection=ccrs.Mollweide())\n",
"ax.stock_img();"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Adding data to the map\n",
"\n",
"Once you have the map just the way you want it, data can be added to it in exactly the same way as with normal matplotlib axes. By default, the coordinate system of any data added to a GeoAxes is the same as the coordinate system of the GeoAxes itself, to control which coordinate system that the given data is in, you can add the transform keyword with an appropriate cartopy.crs.CRS instance:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib inline\n",
"import cartopy.crs as ccrs\n",
"import matplotlib.pyplot as plt\n",
"\n",
"plt.figure(figsize=(12, 12))\n",
"ax = plt.axes(projection=ccrs.PlateCarree())\n",
"ax.stock_img()\n",
"\n",
"ny_lon, ny_lat = -75, 43\n",
"delhi_lon, delhi_lat = 77.23, 28.61\n",
"\n",
"plt.plot([ny_lon, delhi_lon], [ny_lat, delhi_lat],\n",
" color='blue', linewidth=2, marker='o',\n",
" transform=ccrs.Geodetic(),\n",
" )\n",
"\n",
"plt.plot([ny_lon, delhi_lon], [ny_lat, delhi_lat],\n",
" color='gray', linestyle='--',\n",
" transform=ccrs.PlateCarree(),\n",
" )\n",
"\n",
"plt.text(ny_lon - 3, ny_lat - 12, 'New York',\n",
" horizontalalignment='right',\n",
" transform=ccrs.Geodetic())\n",
"\n",
"plt.text(delhi_lon + 3, delhi_lat - 12, 'Delhi',\n",
" horizontalalignment='left',\n",
" transform=ccrs.Geodetic());"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Notice how the line in blue between New York and Delhi is not straight on a flat PlateCarree map, this is because the Geodetic coordinate system is a truly spherical coordinate system, where a line between two points is defined as the shortest path between those points on the globe rather than 2d Cartesian space."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
""
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3.0
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.0"
},
"latex_envs": {
"bibliofile": "biblio.bib",
"cite_by": "apalike",
"current_citInitial": 1.0,
"eqLabelWithNumbers": true,
"eqNumInitial": 0.0
}
},
"nbformat": 4,
"nbformat_minor": 0
}

View File

@ -0,0 +1,703 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# CARTOPY_Projections"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"* [PlateCarree](#PlateCarree)\n",
"* [AzimuthalEquidistant](#AzimuthalEquidistant)\n",
"* [LambertConformal](#LambertConformal)\n",
"* [LambertCylindrical](#LambertCylindrical)\n",
"* [Mercator](#Mercator)\n",
"* [Miller](#Miller)\n",
"* [Mollweide](#Mollweide)\n",
"* [Orthographic](#Orthographic)\n",
"* [Robinson](#Robinson)\n",
"* [Stereographic](#Stereographic)\n",
"* [TransverseMercator](#TransverseMercator)\n",
"* [UTM](#UTM)\n",
"* [InterruptedGoodeHomolosine](#InterruptedGoodeHomolosine)\n",
"* [RotatedPole](#RotatedPole)\n",
"* [OSGB](#OSGB)\n",
"* [EuroPP](#EuroPP)\n",
"* [Geostationary](#Geostationary)\n",
"* [Gnomonic](#Gnomonic)\n",
"* [NorthPolarStereo](#NorthPolarStereo)\n",
"* [OSNI](#OSNI)\n",
"* [SouthPolarStereo](#SouthPolarStereo)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib inline\n",
"import matplotlib.pyplot as plt\n",
"import cartopy.crs as ccrs"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"---\n",
"## PlateCarree\n",
"[projection list](#CARTOPY_Projections)\n",
"\n",
"```\n",
"class cartopy.crs.PlateCarree(central_longitude=0.0, globe=None)[source]\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"plt.figure(figsize=(12, 12))\n",
"ax = plt.axes(projection=ccrs.PlateCarree())\n",
"ax.coastlines(resolution='110m')\n",
"ax.stock_img()\n",
"ax.gridlines();"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"* set the central longitude to $180^\\circ$"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"plt.figure(figsize=(12, 12))\n",
"ax = plt.axes(projection=ccrs.PlateCarree(central_longitude=180))\n",
"ax.coastlines(resolution='110m')\n",
"ax.stock_img()\n",
"ax.gridlines();"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## AzimuthalEquidistant\n",
"[projection list](#CARTOPY_Projections)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## LambertConformal\n",
"[projection list](#CARTOPY_Projections)\n",
"\n",
"\n",
"```class cartopy.crs.LambertConformal(central_longitude=-96.0, central_latitude=39.0, false_easting=0.0, false_northing=0.0, secant_latitudes=None, standard_parallels=None, globe=None, cutoff=-30)\n",
"```\n",
"\n",
"A Lambert Conformal conic projection.\n",
"\n",
"Kwargs:\n",
"\n",
"* central_longitude - The central longitude. \n",
" Defaults to 0.\n",
"\n",
"* central_latitude - The central latitude. \n",
" Defaults to 0.\n",
"\n",
"* false_easting - X offset from planar origin in metres.\n",
" Defaults to 0.\n",
"\n",
"* false_northing - Y offset from planar origin in metres.\n",
" Defaults to 0.\n",
"\n",
"* standard_parallels - Standard parallel latitude(s).\n",
" Defaults to (33, 45).\n",
"\n",
"* globe - A cartopy.crs.Globe.\n",
" If omitted, a default globe is created.\n",
"\n",
"* cutoff - Latitude of map cutoff.\n",
" The map extends to infinity opposite the central pole so we must cut off the map drawing before then. A value of 0 will draw half the globe. Defaults to -30."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"plt.figure(figsize=(12, 12))\n",
"ax = plt.axes(projection=ccrs.LambertConformal())\n",
"ax.coastlines(resolution='110m')\n",
"ax.gridlines();"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## LambertCylindrical\n",
"[projection list](#CARTOPY_Projections)\n",
"\n",
"```\n",
"class cartopy.crs.LambertCylindrical(central_longitude=0.0)\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"plt.figure(figsize=(12, 12))\n",
"ax = plt.axes(projection=ccrs.LambertCylindrical())\n",
"ax.coastlines(resolution='110m')\n",
"ax.stock_img()\n",
"ax.gridlines();"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Mercator\n",
"[projection list](#CARTOPY_Projections)\n",
"\n",
"```\n",
"class cartopy.crs.Mercator(central_longitude=0.0, min_latitude=-80.0, max_latitude=84.0, globe=None)\n",
"```\n",
"\n",
"A Mercator projection.\n",
"\n",
"Kwargs:\n",
"\n",
"* central_longitude - the central longitude. Defaults to 0.\n",
"\n",
"* min_latitude - the maximum southerly extent of the projection.\n",
" Defaults to -80 degrees.\n",
"\n",
"* max_latitude - the maximum northerly extent of the projection.\n",
" Defaults to 84 degrees.\n",
"\n",
"* globe - A cartopy.crs.Globe.\n",
" If omitted, a default globe is created."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"plt.figure(figsize=(12, 12))\n",
"ax = plt.axes(projection=ccrs.Mercator())\n",
"ax.coastlines(resolution='110m')\n",
"ax.stock_img()\n",
"ax.gridlines();"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Miller\n",
"[projection list](#CARTOPY_Projections)\n",
"\n",
"```\n",
"class cartopy.crs.Miller(central_longitude=0.0)\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"plt.figure(figsize=(12, 12))\n",
"ax = plt.axes(projection=ccrs.Miller())\n",
"ax.coastlines(resolution='110m')\n",
"ax.stock_img()\n",
"ax.gridlines();"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Mollweide\n",
"[projection list](#CARTOPY_Projections)\n",
"\n",
"```\n",
"class cartopy.crs.Mollweide(central_longitude=0, globe=None)\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"plt.figure(figsize=(12, 12))\n",
"ax = plt.axes(projection=ccrs.Mollweide())\n",
"ax.coastlines(resolution='110m')\n",
"ax.stock_img()\n",
"ax.gridlines();"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Orthographic\n",
"[projection list](#CARTOPY_Projections)\n",
"\n",
"```\n",
"class cartopy.crs.Orthographic(central_longitude=0.0, central_latitude=0.0, globe=None)\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"plt.figure(figsize=(12, 12))\n",
"ax = plt.axes(projection=ccrs.Orthographic())\n",
"ax.coastlines(resolution='110m')\n",
"ax.stock_img()\n",
"ax.gridlines();"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Robinson\n",
"[projection list](#CARTOPY_Projections)\n",
"\n",
"```\n",
"class cartopy.crs.Robinson(central_longitude=0, globe=None)\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"plt.figure(figsize=(12, 12))\n",
"ax = plt.axes(projection=ccrs.Robinson())\n",
"ax.coastlines(resolution='110m')\n",
"ax.stock_img()\n",
"ax.gridlines();"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Stereographic \n",
"[projection list](#CARTOPY_Projections)\n",
"\n",
"```\n",
"class cartopy.crs.Stereographic(central_latitude=0.0, central_longitude=0.0, false_easting=0.0, false_northing=0.0, true_scale_latitude=None, globe=None)\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"plt.figure(figsize=(12, 12))\n",
"ax = plt.axes(projection=ccrs.Stereographic())\n",
"ax.coastlines(resolution='110m')\n",
"ax.gridlines();"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## TransverseMercator\n",
"[projection list](#CARTOPY_Projections)\n",
"\n",
"```\n",
"class cartopy.crs.TransverseMercator(central_longitude=0.0, central_latitude=0.0, false_easting=0.0, false_northing=0.0, scale_factor=1.0, globe=None)\n",
"```\n",
"A Transverse Mercator projection.\n",
"\n",
"Kwargs:\n",
"\n",
"* central_longitude - The true longitude of the central meridian in\n",
" degrees. Defaults to 0.\n",
"\n",
"* central_latitude - The true latitude of the planar origin in\n",
" degrees. Defaults to 0.\n",
"\n",
"* false_easting - X offset from the planar origin in metres.\n",
" Defaults to 0.\n",
"\n",
"* false_northing - Y offset from the planar origin in metres.\n",
" Defaults to 0.\n",
"\n",
"* scale_factor - Scale factor at the central meridian. Defaults\n",
" to 1.\n",
"\n",
"* globe - An instance of cartopy.crs.Globe. If omitted, a\n",
" default globe is created."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"plt.figure(figsize=(12, 12))\n",
"ax = plt.axes(projection=ccrs.TransverseMercator())\n",
"ax.coastlines(resolution='110m')\n",
"ax.gridlines();"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## UTM\n",
"[projection list](#CARTOPY_Projections)\n",
"\n",
"```\n",
"class cartopy.crs.UTM(zone, southern_hemisphere=False, globe=None)\n",
"```\n",
"\n",
"Universal Transverse Mercator projection.\n",
"\n",
"Kwargs:\n",
"\n",
"* zone - the numeric zone of the UTM required.\n",
"\n",
"* globe - An instance of cartopy.crs.Globe. If omitted, a\n",
" default globe is created.\n",
"\n",
"* southern_hemisphere - set to True if the zone is in the southern\n",
" hemisphere, defaults to False."
]
},
{
"cell_type": "raw",
"metadata": {},
"source": [
"plt.figure(figsize=(3, 3))\n",
"ax = plt.axes(projection=ccrs.UTM(zone=18))\n",
"ax.coastlines(resolution='110m')\n",
"ax.gridlines()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## InterruptedGoodeHomolosine\n",
"[projection list](#CARTOPY_Projections)\n",
"\n",
"```\n",
"class cartopy.crs.InterruptedGoodeHomolosine(central_longitude=0, globe=None)\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"plt.figure(figsize=(12, 12))\n",
"ax = plt.axes(projection=ccrs.InterruptedGoodeHomolosine())\n",
"ax.coastlines(resolution='110m')\n",
"ax.stock_img()\n",
"ax.gridlines();"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## RotatedPole\n",
"[projection list](#CARTOPY_Projections)\n",
"\n",
"```\n",
"class cartopy.crs.RotatedPole(pole_longitude=0.0, pole_latitude=90.0, central_rotated_longitude=0.0, globe=None)\n",
"```\n",
"\n",
"Defines a rotated latitude/longitude projected coordinate system with cylindrical topology and projected distance.\n",
"\n",
"Coordinates are measured in projection metres.\n",
"\n",
"Create a RotatedPole CRS.\n",
"\n",
"The class uses proj4 to perform an ob_tran operation, using the pole_longitude to set a lon_0 then performing two rotations based on pole_latitude and central_rotated_longitude. This is equivalent to setting the new pole to a location defined by the pole_latitude and pole_longitude values in the GeogCRS defined by globe, then rotating this new CRS about its pole using the central_rotated_longitude value.\n",
"\n",
"Args:\n",
"\n",
"* pole_longitude - Pole longitude position, in unrotated degrees.\n",
"\n",
"* pole_latitude - Pole latitude position, in unrotated degrees.\n",
"\n",
"* central_rotated_longitude - Longitude rotation about the new\n",
" pole, in degrees.\n",
"\n",
"Kwargs:\n",
"\n",
"* globe - An optional cartopy.crs.Globe.\n",
" Defaults to a “WGS84” datum."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"plt.figure(figsize=(12, 12))\n",
"ax = plt.axes(projection=ccrs.RotatedPole(pole_latitude=37.5, pole_longitude=177.5))\n",
"ax.coastlines(resolution='110m')\n",
"ax.stock_img()\n",
"ax.gridlines();"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## OSGB\n",
"[projection list](#CARTOPY_Projections)\n",
"\n",
"```class cartopy.crs.OSGB```"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"plt.figure(figsize=(12, 12))\n",
"ax = plt.axes(projection=ccrs.OSGB())\n",
"ax.coastlines(resolution='110m')\n",
"ax.stock_img()\n",
"ax.gridlines();"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## EuroPP\n",
"[projection list](#CARTOPY_Projections)\n",
"\n",
"```class cartopy.crs.EuroPP\n",
"```\n",
"\n",
"UTM Zone 32 projection for EuroPP domain.\n",
"\n",
"Ellipsoid is International 1924, Datum is ED50."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"plt.figure(figsize=(12, 12))\n",
"ax = plt.axes(projection=ccrs.EuroPP())\n",
"ax.coastlines(resolution='110m')\n",
"ax.stock_img()\n",
"ax.gridlines();"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Geostationary\n",
"[projection list](#CARTOPY_Projections)\n",
"\n",
"```\n",
"class cartopy.crs.Geostationary(central_longitude=0.0, satellite_height=35785831, false_easting=0, false_northing=0, globe=None)\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"plt.figure(figsize=(12, 12))\n",
"ax = plt.axes(projection=ccrs.Geostationary())\n",
"ax.coastlines(resolution='110m')\n",
"ax.stock_img()\n",
"ax.gridlines();"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Gnomonic\n",
"[projection list](#CARTOPY_Projections)\n",
"\n",
"```\n",
"class cartopy.crs.Gnomonic(central_latitude=0.0, globe=None)\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"plt.figure(figsize=(12, 12))\n",
"ax = plt.axes(projection=ccrs.Gnomonic())\n",
"ax.coastlines(resolution='110m')\n",
"ax.stock_img()\n",
"ax.gridlines();"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## NorthPolarStereo\n",
"[projection list](#CARTOPY_Projections)\n",
"\n",
"```\n",
"class cartopy.crs.NorthPolarStereo(central_longitude=0.0, globe=None)\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"plt.figure(figsize=(12, 12))\n",
"ax = plt.axes(projection=ccrs.NorthPolarStereo())\n",
"ax.coastlines(resolution='110m')\n",
"ax.stock_img()\n",
"ax.gridlines();"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## OSNI\n",
"[projection list](#CARTOPY_Projections)\n",
"\n",
"```class cartopy.crs.OSNI```"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# note:\n",
"# coastlines methods can use several resolution (110m, 50m, 10m)\n",
"# for convenience here we use 110m\n",
"# see :\n",
"# ax.coastlines?"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"plt.figure(figsize=(12, 12))\n",
"ax = plt.axes(projection=ccrs.OSNI())\n",
"ax.coastlines(resolution='110m')\n",
"ax.stock_img()\n",
"ax.gridlines();"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## SouthPolarStereo \n",
"[projection list](#CARTOPY_Projections)\n",
"\n",
"```class cartopy.crs.SouthPolarStereo(central_longitude=0.0, globe=None)```"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"plt.figure(figsize=(12, 12))\n",
"ax = plt.axes(projection=ccrs.SouthPolarStereo())\n",
"ax.coastlines(resolution='110m')\n",
"ax.stock_img()\n",
"ax.gridlines();"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3.0
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.0"
}
},
"nbformat": 4,
"nbformat_minor": 0
}