SlideShare a Scribd company logo
1 of 22
Download to read offline
Open Source GIS

Geographic scripting in uDig - halfway
    between user and developer
  Geoinformation Research Group, Department of Geography
                   University of Potsdam
                        March 2013




                 JGrasstools & Geoscript
                        Tutor: Andrea Antonello




    ydroloGIS             nvironmental                 ngineering
 HydroloGIS S.r.l. - Via Siemens, 19 - 39100 Bolzano   www.hydrologis.com
Raster in Geoscript - the JGrasstools project
At the time of writing of this tutorial Geoscript didn't support much of raster

data handling.


uDig can do a lot of raster processing through the Spatial Toolbox and the

JGrasstools libraries.


That means that we can access from Geoscript the exact same processing

modules and exploit their raster processing power.


The JGrasstools project is a more then a decade old project that specializes

on geomorphology and hydrology.


Since in those fields most of the processing is done on raster data, a lot of

utilities the handle rasters are available in the library.
The main class that we will use is the Raster class, which wraps the data

and allows us to access the data and main properties.


The latest libraries can be downloaded from the projects download area.


The modules needed to work with geoscripts are:

 • jgt-jgrassgears-XXX.jar

 • jgt-hortonmachine-XXX.jar

 • jgt-modules-XXX.jar

Once donwnloaded, they need to be copied inside a folder named

spatialtoolbox in the installation folder of uDig.
An example dataset

To do some tests we can download the Spearfish raster dataset.


Once unzipped and loaded in uDig and styled it should look like:
Reading the properties of a raster



To access raster data and use them inside scripts, the Raster class is your

friend.

 path = "/home/moovida/giscourse/data_1_3/spearfish_elevation/elevation.asc"
 elev = Raster.read(path)

 println """
 Spearfish properties
 --------------------------------
         north = ${elev.north}
         south = ${elev.south}
         west = ${elev.west}
         east = ${elev.east}
         cols = ${elev.cols}
         rows = ${elev.rows}
         cellsize = ${elev.res}
 """
Reading more properties of a raster

Through the Raster object we can loop over the map and calculate some

basic statistics, like average, max and min elevation:

 path = "/home/moovida/giscourse/data_1_3/spearfish_elevation/elevation.asc"
 elev = Raster.read(path)

 count   = 0
 sum =   0
 min =   10000000 // initialize to something high
 max =   0 // initialize to something low
 for (   col in 0..(elev.cols-1) ){
           for ( row in 0..(elev.rows-1) ){
                   value = elev.valueAt( col, row )
                   if(!elev.isNoValue( value )){
                           count++
                           sum = sum + value
                           if(value > max ) max = value
                           if(value < min ) min = value
                   }
           }
 }
 println   "Max elevation: ${max}"
 println   "Min elevation: ${min}"
 println   "Average elevation: ${sum/count}"
 println   "Valid cells: ${count} of ${elev.cols*elev.rows}"
Putting the raster max and min elevation in a shapefile

path = "/home/moovida/giscourse/data_1_3/spearfish_elevation/elevation.asc"
dir = new Directory("/home/moovida/giscourse/data_1_3/spearfish_elevation/")
// create the vector layer for the max and min
layer = dir.create('spearfish_max_min',[['geom','Point','epsg:26713'],
                         ['type','string'],['value','double']])
// get max and min from raster
elev = Raster.read(path)
count = 0
min = 10000000; minCol = 0; minRow = 0 // can be put on one line using semicolon
max = 0; maxCol = 0; maxRow = 0
for ( col in 0..(elev.cols-1) ){
        for ( row in 0..(elev.rows-1) ){
                value = elev.valueAt( col, row )
                if(!elev.isNoValue( value )){
                         if(value > max ) {
                                 max = value
                                 maxCol = col // important, keep also the
                                 maxRow = row // positions of the max and min
                         }
                         if(value < min ) {
                                 min = value
                                 minCol = col
                                 minRow = row
                         }
                }
        }
}
// get the world position from the raster grid position
minXY = elev.positionAt(minCol, minRow)
maxXY = elev.positionAt(maxCol, maxRow)
// add the features
layer.add([new Point(minXY[0], minXY[1]),'min', min])
layer.add([new Point(maxXY[0], maxXY[1]),'max', max])
The result should look like:
Create a new raster

A new raster can be created from an existing one by using it as a template.

To see how a new raster is created, we can extarct all those parts from the

raster map, in which the elevation lies within the elevation of 1400 and 1600

meters:

 path = "/home/moovida/giscourse/data_1_3/spearfish_elevation/elevation.asc"
 outPath = "/home/moovida/giscourse/data_1_3/spearfish_elevation/elev_1400_1600.asc"
 elev = Raster.read(path)
 // create a new raster using elev as template
 newElev = new Raster(elev)
 // loop over the elevation and pick only values between 1440 and 1600
 for ( col in 0..(elev.cols-1) ){
         for ( row in 0..(elev.rows-1) ){
                 value = elev.valueAt( col, row )
                 if(value < 1600.0 && value > 1400.0 ) {
                          // set the elevation in the new raster
                          newElev.setValueAt( col, row, value )
                 }
         }
 }
 // write the raster to file
 newElev.write(outPath)
The result should look like, if overlayed in greyscale style:
Neighbour operations

With the raster object it is possible to access the neighbour cell values. In

this example we will extract pits:

 path = "/home/moovida/giscourse/data_1_3/spearfish_elevation/elevation.asc"
 dir = new Directory("/home/moovida/giscourse/data_1_3/spearfish_elevation/")
 // create the vector layer for the pits
 layer = dir.create('spearfish_pits',[['geom','Point','epsg:26713'],
                                       ['value','double']])
 elev = Raster.read(path)
 for ( col in 0..(elev.cols-1) ){
         for ( row in 0..(elev.rows-1) ){
                 value = elev.valueAt( col, row )
                 if(!elev.isNoValue( value )){
                          // get all neighbour values
                          surr = elev.surrounding(col, row)
                          isPit = true
                          surr.each(){ neighValue -> // check if one is smaller
                                  if(neighValue <= value ) isPit = false
                          }
                          if(isPit){
                                  // add pits to the vector layer
                                  xy = elev.positionAt(col, row)
                                  layer.add([new Point(xy[0], xy[1]), value])
                          }
                 }
         }
 }
Which should look like:
Geomorphologic analyses
The JGrasstools project supplies a whole pile of modules. Two methods help

to get started.


The help method shows the help for the module in the console:

 new Aspect().help()
The template method:

 new Aspect().template()



on each module provides a syntax blueprint which can be used as startpoint
Aspect




Using the template as starting point, let's calculate the map of aspect from th

elevation model:

 // set in and out paths
 path = "/home/moovida/giscourse/data_1_3/spearfish_elevation/elevation.asc"
 outPath = "/home/moovida/giscourse/data_1_3/spearfish_elevation/aspect.asc"

 // run the aspect module
 Aspect aspect = new Aspect();
 aspect.inElev = path;
 aspect.outAspect = outPath;
 aspect.process();
Which should look like:
Contours extraction




The ContourExtractor module can be used to extract contour lines:

 // set in and out paths
 path = "/home/moovida/giscourse/data_1_3/spearfish_elevation/elevation.asc"
 outPath = "/home/moovida/giscourse/data_1_3/spearfish_elevation/contours.shp"

 // run the module defining start, end and contours interval
 ContourExtractor contourextractor = new ContourExtractor();
 contourextractor.inCoverage = path;
 contourextractor.pMin = 1000;
 contourextractor.pMax = 2000;
 contourextractor.pInterval = 20;
 contourextractor.outGeodata = outPath;
 contourextractor.process();
Which should look like:
Network extraction

A network extraction can be done in 3 steps: flowdirections + tca, raster net,

vector net:

 // set all in and out paths
 path = "/home/moovida/giscourse/data_1_3/spearfish_elevation/elevation.asc"
 flowpath = "/home/moovida/giscourse/data_1_3/spearfish_elevation/flow.asc"
 tcapath = "/home/moovida/giscourse/data_1_3/spearfish_elevation/tca.asc"
 netpath = "/home/moovida/giscourse/data_1_3/spearfish_elevation/net.asc"
 netshppath = "/home/moovida/giscourse/data_1_3/spearfish_elevation/net.shp"

 // calculate flowdirections and tca
 LeastCostFlowDirections leastcostflowdirections = new LeastCostFlowDirections();
 leastcostflowdirections.inElev = path;
 leastcostflowdirections.outFlow = flowpath;
 leastcostflowdirections.outTca = tcapath;
 leastcostflowdirections.process();

 // extract the network raster
 ExtractNetwork extractnetwork = new ExtractNetwork();
 extractnetwork.inTca = tcapath;
 extractnetwork.inFlow = flowpath;
 extractnetwork.pThres = 100;
 extractnetwork.outNet = netpath;
 extractnetwork.process();

 // convert the network to shapefile
 NetworkAttributesBuilder networkattributesbuilder = new NetworkAttributesBuilder();
 networkattributesbuilder.inNet = netpath;
 networkattributesbuilder.inFlow = flowpath;
 networkattributesbuilder.inTca = tcapath;
 networkattributesbuilder.outNet = netshppath;
 networkattributesbuilder.process();
The first maps extracted are the ones of flowdirections and total contributing

area. The map of TCA already suggests the network paths:
In the second step the raster network was extracted:
In the third step the raster network can be transformed to shapefile:

More Related Content

What's hot

D3 svg & angular
D3 svg & angularD3 svg & angular
D3 svg & angular500Tech
 
Drawing with the HTML5 Canvas
Drawing with the HTML5 CanvasDrawing with the HTML5 Canvas
Drawing with the HTML5 CanvasHenry Osborne
 
ggtimeseries-->ggplot2 extensions
ggtimeseries-->ggplot2 extensions ggtimeseries-->ggplot2 extensions
ggtimeseries-->ggplot2 extensions Dr. Volkan OBAN
 
Html5 canvas
Html5 canvasHtml5 canvas
Html5 canvasGary Yeh
 
Exploring Canvas
Exploring CanvasExploring Canvas
Exploring CanvasKevin Hoyt
 
Introduction to HTML5 Canvas
Introduction to HTML5 CanvasIntroduction to HTML5 Canvas
Introduction to HTML5 CanvasMindy McAdams
 
Reactive data visualisations with Om
Reactive data visualisations with OmReactive data visualisations with Om
Reactive data visualisations with OmAnna Pawlicka
 
Introduction to d3js (and SVG)
Introduction to d3js (and SVG)Introduction to d3js (and SVG)
Introduction to d3js (and SVG)zahid-mian
 
03 Geographic scripting in uDig - halfway between user and developer
03 Geographic scripting in uDig - halfway between user and developer03 Geographic scripting in uDig - halfway between user and developer
03 Geographic scripting in uDig - halfway between user and developerAndrea Antonello
 
SVGo: a Go Library for SVG generation
SVGo: a Go Library for SVG generationSVGo: a Go Library for SVG generation
SVGo: a Go Library for SVG generationAnthony Starks
 
Monad - a functional design pattern
Monad - a functional design patternMonad - a functional design pattern
Monad - a functional design patternMårten Rånge
 
The Algorithms of CSS @ CSSConf EU 2018
The Algorithms of CSS @ CSSConf EU 2018The Algorithms of CSS @ CSSConf EU 2018
The Algorithms of CSS @ CSSConf EU 2018Lara Schenck
 
D3js learning tips
D3js learning tipsD3js learning tips
D3js learning tipsLearningTech
 
THE DATA DRIVEN WEB OF NOW: EXTENDING D3JS (Travis Smith)
THE DATA DRIVEN WEB OF NOW: EXTENDING D3JS (Travis Smith)THE DATA DRIVEN WEB OF NOW: EXTENDING D3JS (Travis Smith)
THE DATA DRIVEN WEB OF NOW: EXTENDING D3JS (Travis Smith)Future Insights
 

What's hot (20)

D3 svg & angular
D3 svg & angularD3 svg & angular
D3 svg & angular
 
Data import-cheatsheet
Data import-cheatsheetData import-cheatsheet
Data import-cheatsheet
 
d3 is cool
d3 is coold3 is cool
d3 is cool
 
Drawing with the HTML5 Canvas
Drawing with the HTML5 CanvasDrawing with the HTML5 Canvas
Drawing with the HTML5 Canvas
 
ggtimeseries-->ggplot2 extensions
ggtimeseries-->ggplot2 extensions ggtimeseries-->ggplot2 extensions
ggtimeseries-->ggplot2 extensions
 
Html5 canvas
Html5 canvasHtml5 canvas
Html5 canvas
 
PART 5: RASTER DATA
PART 5: RASTER DATAPART 5: RASTER DATA
PART 5: RASTER DATA
 
Exploring Canvas
Exploring CanvasExploring Canvas
Exploring Canvas
 
Introduction to HTML5 Canvas
Introduction to HTML5 CanvasIntroduction to HTML5 Canvas
Introduction to HTML5 Canvas
 
Reactive data visualisations with Om
Reactive data visualisations with OmReactive data visualisations with Om
Reactive data visualisations with Om
 
Introduction to d3js (and SVG)
Introduction to d3js (and SVG)Introduction to d3js (and SVG)
Introduction to d3js (and SVG)
 
D3
D3D3
D3
 
03 Geographic scripting in uDig - halfway between user and developer
03 Geographic scripting in uDig - halfway between user and developer03 Geographic scripting in uDig - halfway between user and developer
03 Geographic scripting in uDig - halfway between user and developer
 
HTML5 Canvas
HTML5 CanvasHTML5 Canvas
HTML5 Canvas
 
SVGo: a Go Library for SVG generation
SVGo: a Go Library for SVG generationSVGo: a Go Library for SVG generation
SVGo: a Go Library for SVG generation
 
Canvas
CanvasCanvas
Canvas
 
Monad - a functional design pattern
Monad - a functional design patternMonad - a functional design pattern
Monad - a functional design pattern
 
The Algorithms of CSS @ CSSConf EU 2018
The Algorithms of CSS @ CSSConf EU 2018The Algorithms of CSS @ CSSConf EU 2018
The Algorithms of CSS @ CSSConf EU 2018
 
D3js learning tips
D3js learning tipsD3js learning tips
D3js learning tips
 
THE DATA DRIVEN WEB OF NOW: EXTENDING D3JS (Travis Smith)
THE DATA DRIVEN WEB OF NOW: EXTENDING D3JS (Travis Smith)THE DATA DRIVEN WEB OF NOW: EXTENDING D3JS (Travis Smith)
THE DATA DRIVEN WEB OF NOW: EXTENDING D3JS (Travis Smith)
 

Viewers also liked

Opensource gis development - part 1
Opensource gis development - part 1Opensource gis development - part 1
Opensource gis development - part 1Andrea Antonello
 
Opensource gis development - part 3
Opensource gis development - part 3Opensource gis development - part 3
Opensource gis development - part 3Andrea Antonello
 
02 Geographic scripting in uDig - halfway between user and developer
02 Geographic scripting in uDig - halfway between user and developer02 Geographic scripting in uDig - halfway between user and developer
02 Geographic scripting in uDig - halfway between user and developerAndrea Antonello
 
Opensource gis development - part 2
Opensource gis development - part 2Opensource gis development - part 2
Opensource gis development - part 2Andrea Antonello
 
04 Geographic scripting in uDig - halfway between user and developer
04 Geographic scripting in uDig - halfway between user and developer04 Geographic scripting in uDig - halfway between user and developer
04 Geographic scripting in uDig - halfway between user and developerAndrea Antonello
 
Opensource gis development - part 5
Opensource gis development - part 5Opensource gis development - part 5
Opensource gis development - part 5Andrea Antonello
 

Viewers also liked (6)

Opensource gis development - part 1
Opensource gis development - part 1Opensource gis development - part 1
Opensource gis development - part 1
 
Opensource gis development - part 3
Opensource gis development - part 3Opensource gis development - part 3
Opensource gis development - part 3
 
02 Geographic scripting in uDig - halfway between user and developer
02 Geographic scripting in uDig - halfway between user and developer02 Geographic scripting in uDig - halfway between user and developer
02 Geographic scripting in uDig - halfway between user and developer
 
Opensource gis development - part 2
Opensource gis development - part 2Opensource gis development - part 2
Opensource gis development - part 2
 
04 Geographic scripting in uDig - halfway between user and developer
04 Geographic scripting in uDig - halfway between user and developer04 Geographic scripting in uDig - halfway between user and developer
04 Geographic scripting in uDig - halfway between user and developer
 
Opensource gis development - part 5
Opensource gis development - part 5Opensource gis development - part 5
Opensource gis development - part 5
 

Similar to Open Source GIS Tools for Raster Analysis and Geomorphology

The Canvas API for Rubyists
The Canvas API for RubyistsThe Canvas API for Rubyists
The Canvas API for Rubyistsdeanhudson
 
Opensource gis development - part 4
Opensource gis development - part 4Opensource gis development - part 4
Opensource gis development - part 4Andrea Antonello
 
(BDT401) Big Data Orchestra - Harmony within Data Analysis Tools | AWS re:Inv...
(BDT401) Big Data Orchestra - Harmony within Data Analysis Tools | AWS re:Inv...(BDT401) Big Data Orchestra - Harmony within Data Analysis Tools | AWS re:Inv...
(BDT401) Big Data Orchestra - Harmony within Data Analysis Tools | AWS re:Inv...Amazon Web Services
 
Derive hypsometric curves in GRASS GIS
Derive hypsometric curves in GRASS GISDerive hypsometric curves in GRASS GIS
Derive hypsometric curves in GRASS GISSkyler Sorsby
 
I have compilation errors that I'm struggling with in my code- please.pdf
I have compilation errors that I'm struggling with in my code- please.pdfI have compilation errors that I'm struggling with in my code- please.pdf
I have compilation errors that I'm struggling with in my code- please.pdfColinjHJParsonsa
 
SaveI need help with this maze gui that I wrote in java, I am tryi.pdf
SaveI need help with this maze gui that I wrote in java, I am tryi.pdfSaveI need help with this maze gui that I wrote in java, I am tryi.pdf
SaveI need help with this maze gui that I wrote in java, I am tryi.pdfarihantstoneart
 
Complete the implementation of the Weighted Graph that we began in t.pdf
Complete the implementation of the Weighted Graph that we began in t.pdfComplete the implementation of the Weighted Graph that we began in t.pdf
Complete the implementation of the Weighted Graph that we began in t.pdfmarketing413921
 
GeoGebra JavaScript CheatSheet
GeoGebra JavaScript CheatSheetGeoGebra JavaScript CheatSheet
GeoGebra JavaScript CheatSheetJose Perez
 
interface with mysql.pptx
interface with mysql.pptxinterface with mysql.pptx
interface with mysql.pptxKRITIKAOJHA11
 
Stockage, manipulation et analyse de données matricielles avec PostGIS Raster
Stockage, manipulation et analyse de données matricielles avec PostGIS RasterStockage, manipulation et analyse de données matricielles avec PostGIS Raster
Stockage, manipulation et analyse de données matricielles avec PostGIS RasterACSG Section Montréal
 
openFrameworks 007 - 3D
openFrameworks 007 - 3DopenFrameworks 007 - 3D
openFrameworks 007 - 3Droxlu
 
Better d3 charts with tdd
Better d3 charts with tddBetter d3 charts with tdd
Better d3 charts with tddMarcos Iglesias
 
Bindings: the zen of montage
Bindings: the zen of montageBindings: the zen of montage
Bindings: the zen of montageKris Kowal
 

Similar to Open Source GIS Tools for Raster Analysis and Geomorphology (20)

The Canvas API for Rubyists
The Canvas API for RubyistsThe Canvas API for Rubyists
The Canvas API for Rubyists
 
Opensource gis development - part 4
Opensource gis development - part 4Opensource gis development - part 4
Opensource gis development - part 4
 
(BDT401) Big Data Orchestra - Harmony within Data Analysis Tools | AWS re:Inv...
(BDT401) Big Data Orchestra - Harmony within Data Analysis Tools | AWS re:Inv...(BDT401) Big Data Orchestra - Harmony within Data Analysis Tools | AWS re:Inv...
(BDT401) Big Data Orchestra - Harmony within Data Analysis Tools | AWS re:Inv...
 
Derive hypsometric curves in GRASS GIS
Derive hypsometric curves in GRASS GISDerive hypsometric curves in GRASS GIS
Derive hypsometric curves in GRASS GIS
 
ES6 Overview
ES6 OverviewES6 Overview
ES6 Overview
 
Scala in Places API
Scala in Places APIScala in Places API
Scala in Places API
 
Css5 canvas
Css5 canvasCss5 canvas
Css5 canvas
 
I have compilation errors that I'm struggling with in my code- please.pdf
I have compilation errors that I'm struggling with in my code- please.pdfI have compilation errors that I'm struggling with in my code- please.pdf
I have compilation errors that I'm struggling with in my code- please.pdf
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
 
SaveI need help with this maze gui that I wrote in java, I am tryi.pdf
SaveI need help with this maze gui that I wrote in java, I am tryi.pdfSaveI need help with this maze gui that I wrote in java, I am tryi.pdf
SaveI need help with this maze gui that I wrote in java, I am tryi.pdf
 
Complete the implementation of the Weighted Graph that we began in t.pdf
Complete the implementation of the Weighted Graph that we began in t.pdfComplete the implementation of the Weighted Graph that we began in t.pdf
Complete the implementation of the Weighted Graph that we began in t.pdf
 
GeoGebra JavaScript CheatSheet
GeoGebra JavaScript CheatSheetGeoGebra JavaScript CheatSheet
GeoGebra JavaScript CheatSheet
 
interface with mysql.pptx
interface with mysql.pptxinterface with mysql.pptx
interface with mysql.pptx
 
SVGo workshop
SVGo workshopSVGo workshop
SVGo workshop
 
Lecture 5
Lecture 5Lecture 5
Lecture 5
 
Stockage, manipulation et analyse de données matricielles avec PostGIS Raster
Stockage, manipulation et analyse de données matricielles avec PostGIS RasterStockage, manipulation et analyse de données matricielles avec PostGIS Raster
Stockage, manipulation et analyse de données matricielles avec PostGIS Raster
 
Second chapter-java
Second chapter-javaSecond chapter-java
Second chapter-java
 
openFrameworks 007 - 3D
openFrameworks 007 - 3DopenFrameworks 007 - 3D
openFrameworks 007 - 3D
 
Better d3 charts with tdd
Better d3 charts with tddBetter d3 charts with tdd
Better d3 charts with tdd
 
Bindings: the zen of montage
Bindings: the zen of montageBindings: the zen of montage
Bindings: the zen of montage
 

More from Andrea Antonello

Smash & Geopaparazzi - State of the art 2021
Smash & Geopaparazzi - State of the art 2021Smash & Geopaparazzi - State of the art 2021
Smash & Geopaparazzi - State of the art 2021Andrea Antonello
 
GEOPAPARAZZI: STATE OF THE ART OF THE DIGITAL FIELD MAPPING APPLICATION
GEOPAPARAZZI: STATE OF THE ART OF THE DIGITAL FIELD MAPPING APPLICATIONGEOPAPARAZZI: STATE OF THE ART OF THE DIGITAL FIELD MAPPING APPLICATION
GEOPAPARAZZI: STATE OF THE ART OF THE DIGITAL FIELD MAPPING APPLICATIONAndrea Antonello
 
GEOPAPARAZZI STATE OF THE ART OF THE DIGITAL FIELD MAPPING APPLICATION
GEOPAPARAZZI STATE OF THE ART OF THE DIGITAL FIELD MAPPING APPLICATIONGEOPAPARAZZI STATE OF THE ART OF THE DIGITAL FIELD MAPPING APPLICATION
GEOPAPARAZZI STATE OF THE ART OF THE DIGITAL FIELD MAPPING APPLICATIONAndrea Antonello
 
Geopaparazzi Survey Server workshop
Geopaparazzi Survey Server workshopGeopaparazzi Survey Server workshop
Geopaparazzi Survey Server workshopAndrea Antonello
 
Geopaparazzi Survey Server Installation
Geopaparazzi Survey Server InstallationGeopaparazzi Survey Server Installation
Geopaparazzi Survey Server InstallationAndrea Antonello
 
Modelling natural hazards in gvSIG with the HortonMachine plugins
Modelling natural hazards in gvSIG with the HortonMachine pluginsModelling natural hazards in gvSIG with the HortonMachine plugins
Modelling natural hazards in gvSIG with the HortonMachine pluginsAndrea Antonello
 
GEOPAPARAZZI: STATE OF THE ART
GEOPAPARAZZI: STATE OF THE ARTGEOPAPARAZZI: STATE OF THE ART
GEOPAPARAZZI: STATE OF THE ARTAndrea Antonello
 
Geopaparazzi - NEVER OUT OF DATA IN THE FIELD
Geopaparazzi - NEVER OUT OF DATA IN THE FIELDGeopaparazzi - NEVER OUT OF DATA IN THE FIELD
Geopaparazzi - NEVER OUT OF DATA IN THE FIELDAndrea Antonello
 
The HortonMachine, for data analysis to help scientists... and not only
The HortonMachine, for data analysis to help scientists... and not onlyThe HortonMachine, for data analysis to help scientists... and not only
The HortonMachine, for data analysis to help scientists... and not onlyAndrea Antonello
 
Geopaparazzi & gvSIG Mobile - state of the art
Geopaparazzi & gvSIG Mobile - state of the artGeopaparazzi & gvSIG Mobile - state of the art
Geopaparazzi & gvSIG Mobile - state of the artAndrea Antonello
 
PART 6: FROM GEO INTO YOUR REPORT
PART 6: FROM GEO INTO YOUR REPORTPART 6: FROM GEO INTO YOUR REPORT
PART 6: FROM GEO INTO YOUR REPORTAndrea Antonello
 
PART 4: GEOGRAPHIC SCRIPTING
PART 4: GEOGRAPHIC SCRIPTINGPART 4: GEOGRAPHIC SCRIPTING
PART 4: GEOGRAPHIC SCRIPTINGAndrea Antonello
 
PART 3: THE SCRIPTING COMPOSER AND PYTHON
PART 3: THE SCRIPTING COMPOSER AND PYTHONPART 3: THE SCRIPTING COMPOSER AND PYTHON
PART 3: THE SCRIPTING COMPOSER AND PYTHONAndrea Antonello
 
Foss4g2016 Geopaparazzi Workshop
Foss4g2016 Geopaparazzi WorkshopFoss4g2016 Geopaparazzi Workshop
Foss4g2016 Geopaparazzi WorkshopAndrea Antonello
 
New tools for LiDAR, forestry, river management and hydro-geomorphology in gvSIG
New tools for LiDAR, forestry, river management and hydro-geomorphology in gvSIGNew tools for LiDAR, forestry, river management and hydro-geomorphology in gvSIG
New tools for LiDAR, forestry, river management and hydro-geomorphology in gvSIGAndrea Antonello
 
Digital field mapping with Geopaparazzi and gvSIG
Digital field mapping with Geopaparazzi and gvSIGDigital field mapping with Geopaparazzi and gvSIG
Digital field mapping with Geopaparazzi and gvSIGAndrea Antonello
 
Geopaparazzi, history of a digital mapping kid
Geopaparazzi, history of a digital mapping kidGeopaparazzi, history of a digital mapping kid
Geopaparazzi, history of a digital mapping kidAndrea Antonello
 
Geopaparazzi, state of the art
Geopaparazzi, state of the artGeopaparazzi, state of the art
Geopaparazzi, state of the artAndrea Antonello
 
Geographic scripting in uDig
Geographic scripting in uDigGeographic scripting in uDig
Geographic scripting in uDigAndrea Antonello
 
LESTO - a GIS toolbox for LiDAR empowered sciences
LESTO - a GIS toolbox for LiDAR empowered sciencesLESTO - a GIS toolbox for LiDAR empowered sciences
LESTO - a GIS toolbox for LiDAR empowered sciencesAndrea Antonello
 

More from Andrea Antonello (20)

Smash & Geopaparazzi - State of the art 2021
Smash & Geopaparazzi - State of the art 2021Smash & Geopaparazzi - State of the art 2021
Smash & Geopaparazzi - State of the art 2021
 
GEOPAPARAZZI: STATE OF THE ART OF THE DIGITAL FIELD MAPPING APPLICATION
GEOPAPARAZZI: STATE OF THE ART OF THE DIGITAL FIELD MAPPING APPLICATIONGEOPAPARAZZI: STATE OF THE ART OF THE DIGITAL FIELD MAPPING APPLICATION
GEOPAPARAZZI: STATE OF THE ART OF THE DIGITAL FIELD MAPPING APPLICATION
 
GEOPAPARAZZI STATE OF THE ART OF THE DIGITAL FIELD MAPPING APPLICATION
GEOPAPARAZZI STATE OF THE ART OF THE DIGITAL FIELD MAPPING APPLICATIONGEOPAPARAZZI STATE OF THE ART OF THE DIGITAL FIELD MAPPING APPLICATION
GEOPAPARAZZI STATE OF THE ART OF THE DIGITAL FIELD MAPPING APPLICATION
 
Geopaparazzi Survey Server workshop
Geopaparazzi Survey Server workshopGeopaparazzi Survey Server workshop
Geopaparazzi Survey Server workshop
 
Geopaparazzi Survey Server Installation
Geopaparazzi Survey Server InstallationGeopaparazzi Survey Server Installation
Geopaparazzi Survey Server Installation
 
Modelling natural hazards in gvSIG with the HortonMachine plugins
Modelling natural hazards in gvSIG with the HortonMachine pluginsModelling natural hazards in gvSIG with the HortonMachine plugins
Modelling natural hazards in gvSIG with the HortonMachine plugins
 
GEOPAPARAZZI: STATE OF THE ART
GEOPAPARAZZI: STATE OF THE ARTGEOPAPARAZZI: STATE OF THE ART
GEOPAPARAZZI: STATE OF THE ART
 
Geopaparazzi - NEVER OUT OF DATA IN THE FIELD
Geopaparazzi - NEVER OUT OF DATA IN THE FIELDGeopaparazzi - NEVER OUT OF DATA IN THE FIELD
Geopaparazzi - NEVER OUT OF DATA IN THE FIELD
 
The HortonMachine, for data analysis to help scientists... and not only
The HortonMachine, for data analysis to help scientists... and not onlyThe HortonMachine, for data analysis to help scientists... and not only
The HortonMachine, for data analysis to help scientists... and not only
 
Geopaparazzi & gvSIG Mobile - state of the art
Geopaparazzi & gvSIG Mobile - state of the artGeopaparazzi & gvSIG Mobile - state of the art
Geopaparazzi & gvSIG Mobile - state of the art
 
PART 6: FROM GEO INTO YOUR REPORT
PART 6: FROM GEO INTO YOUR REPORTPART 6: FROM GEO INTO YOUR REPORT
PART 6: FROM GEO INTO YOUR REPORT
 
PART 4: GEOGRAPHIC SCRIPTING
PART 4: GEOGRAPHIC SCRIPTINGPART 4: GEOGRAPHIC SCRIPTING
PART 4: GEOGRAPHIC SCRIPTING
 
PART 3: THE SCRIPTING COMPOSER AND PYTHON
PART 3: THE SCRIPTING COMPOSER AND PYTHONPART 3: THE SCRIPTING COMPOSER AND PYTHON
PART 3: THE SCRIPTING COMPOSER AND PYTHON
 
Foss4g2016 Geopaparazzi Workshop
Foss4g2016 Geopaparazzi WorkshopFoss4g2016 Geopaparazzi Workshop
Foss4g2016 Geopaparazzi Workshop
 
New tools for LiDAR, forestry, river management and hydro-geomorphology in gvSIG
New tools for LiDAR, forestry, river management and hydro-geomorphology in gvSIGNew tools for LiDAR, forestry, river management and hydro-geomorphology in gvSIG
New tools for LiDAR, forestry, river management and hydro-geomorphology in gvSIG
 
Digital field mapping with Geopaparazzi and gvSIG
Digital field mapping with Geopaparazzi and gvSIGDigital field mapping with Geopaparazzi and gvSIG
Digital field mapping with Geopaparazzi and gvSIG
 
Geopaparazzi, history of a digital mapping kid
Geopaparazzi, history of a digital mapping kidGeopaparazzi, history of a digital mapping kid
Geopaparazzi, history of a digital mapping kid
 
Geopaparazzi, state of the art
Geopaparazzi, state of the artGeopaparazzi, state of the art
Geopaparazzi, state of the art
 
Geographic scripting in uDig
Geographic scripting in uDigGeographic scripting in uDig
Geographic scripting in uDig
 
LESTO - a GIS toolbox for LiDAR empowered sciences
LESTO - a GIS toolbox for LiDAR empowered sciencesLESTO - a GIS toolbox for LiDAR empowered sciences
LESTO - a GIS toolbox for LiDAR empowered sciences
 

Recently uploaded

Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 

Recently uploaded (20)

Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 

Open Source GIS Tools for Raster Analysis and Geomorphology

  • 1. Open Source GIS Geographic scripting in uDig - halfway between user and developer Geoinformation Research Group, Department of Geography University of Potsdam March 2013 JGrasstools & Geoscript Tutor: Andrea Antonello ydroloGIS nvironmental ngineering HydroloGIS S.r.l. - Via Siemens, 19 - 39100 Bolzano www.hydrologis.com
  • 2. Raster in Geoscript - the JGrasstools project At the time of writing of this tutorial Geoscript didn't support much of raster data handling. uDig can do a lot of raster processing through the Spatial Toolbox and the JGrasstools libraries. That means that we can access from Geoscript the exact same processing modules and exploit their raster processing power. The JGrasstools project is a more then a decade old project that specializes on geomorphology and hydrology. Since in those fields most of the processing is done on raster data, a lot of utilities the handle rasters are available in the library.
  • 3. The main class that we will use is the Raster class, which wraps the data and allows us to access the data and main properties. The latest libraries can be downloaded from the projects download area. The modules needed to work with geoscripts are: • jgt-jgrassgears-XXX.jar • jgt-hortonmachine-XXX.jar • jgt-modules-XXX.jar Once donwnloaded, they need to be copied inside a folder named spatialtoolbox in the installation folder of uDig.
  • 4. An example dataset To do some tests we can download the Spearfish raster dataset. Once unzipped and loaded in uDig and styled it should look like:
  • 5. Reading the properties of a raster To access raster data and use them inside scripts, the Raster class is your friend. path = "/home/moovida/giscourse/data_1_3/spearfish_elevation/elevation.asc" elev = Raster.read(path) println """ Spearfish properties -------------------------------- north = ${elev.north} south = ${elev.south} west = ${elev.west} east = ${elev.east} cols = ${elev.cols} rows = ${elev.rows} cellsize = ${elev.res} """
  • 6. Reading more properties of a raster Through the Raster object we can loop over the map and calculate some basic statistics, like average, max and min elevation: path = "/home/moovida/giscourse/data_1_3/spearfish_elevation/elevation.asc" elev = Raster.read(path) count = 0 sum = 0 min = 10000000 // initialize to something high max = 0 // initialize to something low for ( col in 0..(elev.cols-1) ){ for ( row in 0..(elev.rows-1) ){ value = elev.valueAt( col, row ) if(!elev.isNoValue( value )){ count++ sum = sum + value if(value > max ) max = value if(value < min ) min = value } } } println "Max elevation: ${max}" println "Min elevation: ${min}" println "Average elevation: ${sum/count}" println "Valid cells: ${count} of ${elev.cols*elev.rows}"
  • 7. Putting the raster max and min elevation in a shapefile path = "/home/moovida/giscourse/data_1_3/spearfish_elevation/elevation.asc" dir = new Directory("/home/moovida/giscourse/data_1_3/spearfish_elevation/") // create the vector layer for the max and min layer = dir.create('spearfish_max_min',[['geom','Point','epsg:26713'], ['type','string'],['value','double']]) // get max and min from raster elev = Raster.read(path) count = 0 min = 10000000; minCol = 0; minRow = 0 // can be put on one line using semicolon max = 0; maxCol = 0; maxRow = 0 for ( col in 0..(elev.cols-1) ){ for ( row in 0..(elev.rows-1) ){ value = elev.valueAt( col, row ) if(!elev.isNoValue( value )){ if(value > max ) { max = value maxCol = col // important, keep also the maxRow = row // positions of the max and min } if(value < min ) { min = value minCol = col minRow = row } } } } // get the world position from the raster grid position minXY = elev.positionAt(minCol, minRow) maxXY = elev.positionAt(maxCol, maxRow) // add the features layer.add([new Point(minXY[0], minXY[1]),'min', min]) layer.add([new Point(maxXY[0], maxXY[1]),'max', max])
  • 8. The result should look like:
  • 9. Create a new raster A new raster can be created from an existing one by using it as a template. To see how a new raster is created, we can extarct all those parts from the raster map, in which the elevation lies within the elevation of 1400 and 1600 meters: path = "/home/moovida/giscourse/data_1_3/spearfish_elevation/elevation.asc" outPath = "/home/moovida/giscourse/data_1_3/spearfish_elevation/elev_1400_1600.asc" elev = Raster.read(path) // create a new raster using elev as template newElev = new Raster(elev) // loop over the elevation and pick only values between 1440 and 1600 for ( col in 0..(elev.cols-1) ){ for ( row in 0..(elev.rows-1) ){ value = elev.valueAt( col, row ) if(value < 1600.0 && value > 1400.0 ) { // set the elevation in the new raster newElev.setValueAt( col, row, value ) } } } // write the raster to file newElev.write(outPath)
  • 10. The result should look like, if overlayed in greyscale style:
  • 11. Neighbour operations With the raster object it is possible to access the neighbour cell values. In this example we will extract pits: path = "/home/moovida/giscourse/data_1_3/spearfish_elevation/elevation.asc" dir = new Directory("/home/moovida/giscourse/data_1_3/spearfish_elevation/") // create the vector layer for the pits layer = dir.create('spearfish_pits',[['geom','Point','epsg:26713'], ['value','double']]) elev = Raster.read(path) for ( col in 0..(elev.cols-1) ){ for ( row in 0..(elev.rows-1) ){ value = elev.valueAt( col, row ) if(!elev.isNoValue( value )){ // get all neighbour values surr = elev.surrounding(col, row) isPit = true surr.each(){ neighValue -> // check if one is smaller if(neighValue <= value ) isPit = false } if(isPit){ // add pits to the vector layer xy = elev.positionAt(col, row) layer.add([new Point(xy[0], xy[1]), value]) } } } }
  • 13. Geomorphologic analyses The JGrasstools project supplies a whole pile of modules. Two methods help to get started. The help method shows the help for the module in the console: new Aspect().help()
  • 14. The template method: new Aspect().template() on each module provides a syntax blueprint which can be used as startpoint
  • 15. Aspect Using the template as starting point, let's calculate the map of aspect from th elevation model: // set in and out paths path = "/home/moovida/giscourse/data_1_3/spearfish_elevation/elevation.asc" outPath = "/home/moovida/giscourse/data_1_3/spearfish_elevation/aspect.asc" // run the aspect module Aspect aspect = new Aspect(); aspect.inElev = path; aspect.outAspect = outPath; aspect.process();
  • 17. Contours extraction The ContourExtractor module can be used to extract contour lines: // set in and out paths path = "/home/moovida/giscourse/data_1_3/spearfish_elevation/elevation.asc" outPath = "/home/moovida/giscourse/data_1_3/spearfish_elevation/contours.shp" // run the module defining start, end and contours interval ContourExtractor contourextractor = new ContourExtractor(); contourextractor.inCoverage = path; contourextractor.pMin = 1000; contourextractor.pMax = 2000; contourextractor.pInterval = 20; contourextractor.outGeodata = outPath; contourextractor.process();
  • 19. Network extraction A network extraction can be done in 3 steps: flowdirections + tca, raster net, vector net: // set all in and out paths path = "/home/moovida/giscourse/data_1_3/spearfish_elevation/elevation.asc" flowpath = "/home/moovida/giscourse/data_1_3/spearfish_elevation/flow.asc" tcapath = "/home/moovida/giscourse/data_1_3/spearfish_elevation/tca.asc" netpath = "/home/moovida/giscourse/data_1_3/spearfish_elevation/net.asc" netshppath = "/home/moovida/giscourse/data_1_3/spearfish_elevation/net.shp" // calculate flowdirections and tca LeastCostFlowDirections leastcostflowdirections = new LeastCostFlowDirections(); leastcostflowdirections.inElev = path; leastcostflowdirections.outFlow = flowpath; leastcostflowdirections.outTca = tcapath; leastcostflowdirections.process(); // extract the network raster ExtractNetwork extractnetwork = new ExtractNetwork(); extractnetwork.inTca = tcapath; extractnetwork.inFlow = flowpath; extractnetwork.pThres = 100; extractnetwork.outNet = netpath; extractnetwork.process(); // convert the network to shapefile NetworkAttributesBuilder networkattributesbuilder = new NetworkAttributesBuilder(); networkattributesbuilder.inNet = netpath; networkattributesbuilder.inFlow = flowpath; networkattributesbuilder.inTca = tcapath; networkattributesbuilder.outNet = netshppath; networkattributesbuilder.process();
  • 20. The first maps extracted are the ones of flowdirections and total contributing area. The map of TCA already suggests the network paths:
  • 21. In the second step the raster network was extracted:
  • 22. In the third step the raster network can be transformed to shapefile: