Merge pull request #5 from epifanio/notebook-debug

notebook-debug
intro16
epifanio 2016-03-21 17:12:01 -03:00
commit 217b67dac5
8 changed files with 109 additions and 221 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,37 +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": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"cell_type": "markdown",
"metadata": {},
"source": [
"!gist -p /tmp/geojson.geojson"
"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"
@ -207,9 +192,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"cesiumExample = CesiumWidget(width=\"100%\",geojson=data, enable_lighting=True)"
@ -218,9 +201,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"cesiumExample"
@ -236,7 +217,7 @@
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
"version": 2.0
},
"file_extension": ".py",
"mimetype": "text/x-python",
@ -248,4 +229,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) - [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",
@ -885,7 +885,7 @@
"\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) ```save spec only``` when saving a data product (this mybe useful when batch processing a complex image chain, or when ossim is built with mpi support to redistribuite the computation on more CPU's)."
"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)."
]
},
{

View File

@ -11,7 +11,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"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 consist in adding an esclamation mark as prefix to a bash command, e.g.: ```!bash-command``` "
"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``` "
]
},
{
@ -43,7 +43,7 @@
"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. "
]
},
{

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"
@ -271,7 +271,7 @@
"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."
]
},
{