This is an automated email from the git hooks/post-receive script.

sebastic-guest pushed a commit to branch upstream-master
in repository pktools.

commit bc172d651b79f0f9e01a89259ef23636a587cab8
Author: Pieter Kempeneers <kempe...@gmail.com>
Date:   Sat Nov 8 23:24:12 2014 +0100

    working on documentation, still need to (re-)do the full description
---
 doc/createappsdox.sh       |  6 ++++++
 doc/examples_pkdumpimg.dox | 29 +++++++++++++++++++++++++++--
 doc/examples_pkdumpogr.dox | 42 ++++++++++++++++++++++++++++++++++++------
 doc/examples_pkextract.dox | 37 ++++++++++++++++++++++++-------------
 doc/examples_pkfilter.dox  | 17 +++++++++++++----
 src/apps/pkdumpimg.cc      | 21 ++++++++++++++-------
 6 files changed, 120 insertions(+), 32 deletions(-)

diff --git a/doc/createappsdox.sh b/doc/createappsdox.sh
index 4239b2a..c497a7e 100755
--- a/doc/createappsdox.sh
+++ b/doc/createappsdox.sh
@@ -50,6 +50,12 @@ for file in ../src/apps/pk*.cc;do
     echo "- \\ref ${THETOOL} ${THESHORTDESCRIPTION}"; 
 done >> ../doc/apps.dox
 
+#remove depricated utilities and those not ready to publish"
+
+for TOOL in pkeditogr pkenhance pkkalman pkndvi pkreclass; do 
+    rm ../doc/${TOOL}.dox ../html/md_doc_${TOOL}.html 
../html/${TOOL}_8cc_source.html
+    sed -i "/${TOOL}/d" ../doc/apps.dox
+done
 echo "Savannah repository for homepage can only be maintained via cvs"
 #mkdir ~/tmp
 #cd ~/tmp
diff --git a/doc/examples_pkdumpimg.dox b/doc/examples_pkdumpimg.dox
index dc04cb2..c2fe0c1 100644
--- a/doc/examples_pkdumpimg.dox
+++ b/doc/examples_pkdumpimg.dox
@@ -1,8 +1,33 @@
 \section examples_pkdumpimg Examples of pkdumpimg
 
-Dump the image content of tiny.tif to screen
+We create a 5x5 raster dataset containing all 0 values except for its center 
(value=1)
 
 \code
-pkdumpimg -i tiny.tif
+cat input.txt
+
+0 0 0 0 0
+0 0 0 0 0
+0 0 1 0 0
+0 0 0 0 0
+0 0 0 0 0
+\endcode
+
+Use \ref pkascii2img "pkascii2img" to create an raster dataset from input.txt
+
+\code
+pkascii2img -i input.txt -o output.tif -of GTiff -a_srs epsg:3035 -dx 25 -dy 
25 -ulx 1000000 -uly 1000000
 \endcode
 
+Dump the image content of output.tif to screen
+
+\code
+pkdumpimg -i output.tif
+\endcode
+
+\code
+0 0 0 0 0
+0 0 0 0 0
+0 0 1 0 0
+0 0 0 0 0
+0 0 0 0 0
+\endcode
diff --git a/doc/examples_pkdumpogr.dox b/doc/examples_pkdumpogr.dox
index cf61c3c..e869e47 100644
--- a/doc/examples_pkdumpogr.dox
+++ b/doc/examples_pkdumpogr.dox
@@ -1,15 +1,45 @@
 \section examples_pkdumpogr Examples of pkdumpogr
+
+Dump the attributes label and description for the vector dataset sample.sqlite 
to standard output (screen)
+
+\code
+pkdumpogr -i sample.sqlite -n label -n description
+\endcode
+
+\code
+0 2 noforest
+1 2 noforest
+2 2 noforest
+3 2 noforest
+4 2 noforest
+5 2 noforest
+6 2 noforest
+7 2 noforest
+8 2 noforest
+9 2 noforest
+10 1 forest
+11 2 noforest
+\endcode
+
+Similar to previous example, but transpose output (does not work without 
explicitly defining options -n for attributes)
+
 \code
-pkdumpogr -i input.shp
+pkdumpogr -i sample.sqlite -n label -n description -t
 \endcode
-dump entire content of vector file to standard output
 
 \code
-pkdumpogr -i input.shp -o output.txt -n ATTRIBUTE -pos
+0 2 2 2 2 2 2 2 2 2 2 1 2
+1 noforest noforest noforest noforest noforest noforest noforest noforest 
noforest noforest forest noforest 
 \endcode
-dump only ATTRIBUTE of vector file including x and y position and output to 
ASCII file
+
+Dump the entire content of vector dataset input.sqlite to standard output
+
+\code
+pkdumpogr -i input.sqlite
+\endcode
+
+Dump only ATTRIBUTE of vector dataset input.sqlite including x and y position 
and output to ASCII file output.txt
 
 \code
-pkdumpogr -i input.shp -o output.txt -n ATTRIBUTE1 -n ATTRIBUTE2 -t
+pkdumpogr -i input.sqlite -o output.txt -n ATTRIBUTE -pos
 \endcode
-dump the two attributes ATTRIBUTE1 and ATTRIBUTE2 of vector file and transpose 
output 
diff --git a/doc/examples_pkextract.dox b/doc/examples_pkextract.dox
index 384d3d9..f9c685c 100644
--- a/doc/examples_pkextract.dox
+++ b/doc/examples_pkextract.dox
@@ -1,68 +1,79 @@
 \section examples_pkextract Examples of pkextract
 
 \subsection example_pkextract_vector Using vector samples
+
+Extract all points for all layers read in points.sqlite from input.tif. Create 
a new point vector dataset named extracted.sqlite, where each point will 
contain an attribute for the individual input bands in input.tif. Notice that 
the default vector format is Spatialite (.sqlite).
+
 \code
 pkextract -i input.tif -s points.sqlite -o extracted.sqlite
 \endcode
-Extract all points for all layers read in points.sqlite from input.tif. Create 
a new point vector dataset named extracted.sqlite, where each point will 
contain an attribute for the individual input bands in input.tif. Notice that 
the default vector format is Spatialite (.sqlite).
+
+Same example as above, but only extract the points for the layer in 
points.sqlite named "valid"
 
 \code
 pkextract -i input.tif -s points.sqlite -ln valid -o extracted.sqlite
 \endcode
-Same example as above, but only extract the points for the layer in 
points.sqlite named "valid"
+
+Extract points and write output in ESRI Shapefile format
 
 \code
 pkextract -i input.tif -s points.shp -f "ESRI Shapefile" -o extracted.shp
 \endcode
-Extract points and write output in ESRI Shapefile format
+
+Extract the standard deviation for each input band in a 3 by 3 window, 
centered around the points in the sample vector dataset points.sqlite. The 
output vector dataset will contain polygon features defined by the buffered 
points (3x3 window). Use the option -circ to define a circular buffer.
 
 \code
 pkextract -i input.tif -s points.sqlite -o extracted.sqlite -r stdev -buf 3 
-polygon
 \endcode
-Extract the standard deviation for each input band in a 3 by 3 window, 
centered around the points in the sample vector dataset points.sqlite. The 
output vector dataset will contain polygon features defined by the buffered 
points (3x3 window). Use the option -circ to define a circular buffer.
+
+Extract all pixels from input.tif covered by the polygons in locations.sqlite. 
Each polygon can thus result in multiple point features with attributes for 
each input band. Write the extracted points to a point vector dataset 
training.sqlite.
 
 \code
 pkextract -i input.tif -s polygons.sqlite -o training.sqlite -r point
 \endcode
-Extract all pixels from input.tif covered by the polygons in locations.sqlite. 
Each polygon can thus result in multiple point features with attributes for 
each input band. Write the extracted points to a point vector dataset 
training.sqlite.
+
+Extract the first band from input.tif at the centroids of the polygons in 
vector dataset polygons.sqlite. Assign the extracted point value to a new 
attribute of the polygon and write to the vector dataset extracted.sqlite.
 
 \code
 pkextract -i input.tif -b 0 -s polygons.sqlite -r centroid -o extracted.sqlite 
-polygon  
 \endcode
-Extract the first band from input.tif at the centroids of the polygons in 
vector dataset polygons.sqlite. Assign the extracted point value to a new 
attribute of the polygon and write to the vector dataset extracted.sqlite.
+Extract the mean values for the second band in input.tif covered by each 
polygon in polygons.sqlite. The mean values are written to a copy of the 
polygons in output vector dataset extracted.sqlite
 
 \code
 pkextract -i input.tif -b 1 -s polygons.sqlite -r mean -o extracted.sqlite 
-polygon  
 \endcode
-Extract the mean values for the second band in input.tif covered by each 
polygon in polygons.sqlite. The mean values are written to a copy of the 
polygons in output vector dataset extracted.sqlite
+
+Extract the majority class in each polygon for the input land cover map. The 
land cover map contains five valid classes, labeled 1-5. Other class values 
(e.g., labeled as 0) are not taken into account in the voting.
 
 \code
 pkextract -i landcover.tif -s polygons.sqlite -r maxvote -o majority.sqlite 
-polygon -c 1 -c 2 -c 3 -c 4 -c 5
 \endcode
-Extract the majority class in each polygon for the input land cover map. The 
land cover map contains five valid classes, labeled 1-5. Other class values 
(e.g., labeled as 0) are not taken into account in the voting.
 
 \subsection example_pkextract_random Using random and grid samples
 
+Extract 100 sample units following a simple random sampling design. For each 
sample unit, the median value is extracted from the input raster dataset in a 
window of 3 by 3 pixels and written to an attribute of the output vector 
dataset. The output vector dataset contains polygon features defined by the 
windows centered at the random selected sample units.
+
 \code
 pkextract -i input.tif -o random.sqlite -rand 100 -median -buf 3 -polygon
 \endcode
-Extract 100 sample units following a simple random sampling design. For each 
sample unit, the median value is extracted from the input raster dataset in a 
window of 3 by 3 pixels and written to an attribute of the output vector 
dataset. The output vector dataset contains polygon features defined by the 
windows centered at the random selected sample units.
+
+Extract points following a systematic grid with grid cell size of 100 m. 
Discard pixels that have a value 0 in the input raster dataset.
 
 \code
 pkextract -i input.tif -o systematic.sqlite -grid 100 -srcnodata 0
 \endcode
-Extract points following a systematic grid with grid cell size of 100 m. 
Discard pixels that have a value 0 in the input raster dataset.
 
 \subsection example_pkextract_raster Using raster samples
 
+Typical use where pixels are extracted based on a land cover map (sample.tif). 
Extract all bands for a random sample of 10 percent of the pixels in the land 
cover map sample.tif where the land cover classes are either 1,2 or 3 (class 
values). Write output to the point vector dataset extracted.sqlite.
+
 \code
 pkextract -i input.tif -s sample.tif -o extracted.sqlite -t 10 -c 1 -c 2 -c 3
 \endcode
-Typical use where pixels are extracted based on a land cover map (sample.tif). 
Extract all bands for a random sample of 10 percent of the pixels in the land 
cover map sample.tif where the land cover classes are either 1,2 or 3 (class 
values). Write output to the point vector dataset extracted.sqlite.
+
+Extract all bands for the first 5000 pixels encountered in sample.tif where 
pixels have a value equal to 1. Write output to point vector dataset 
extracted.sqlite.
 
 \code
 pkextract -i input.tif -s sample.tif -o extracted.sqlite -t -5000 -c 1
 \endcode
-Extract all bands for the first 5000 pixels encountered in sample.tif where 
pixels have a value equal to 1. Write output to point vector dataset 
extracted.sqlite.
-
 
diff --git a/doc/examples_pkfilter.dox b/doc/examples_pkfilter.dox
index 7515b23..e054293 100644
--- a/doc/examples_pkfilter.dox
+++ b/doc/examples_pkfilter.dox
@@ -1,21 +1,30 @@
 \section examples_pkfilter Examples of pkfilter
+
+\subsection examples_pkfilter_spatial Filtering in spatial domain
+
+Filter input.tif with morphological dilation filter. Use a circular kernel 
(instead of rectangular) of size 3x3.
+
 \code
 pkfilter -i input.tif -o filter.tif -dx 3 -dy 3 -f dilate -c
 \endcode
-filter input.tif with morphological dilation filter. Use a circular kernel 
(instead of rectangular) of size 3x3.
+
+Similar to previous example, but consider only values of 255 for filtering 
operation. Typical usage: dilate cloud values in input image that are flagged 
as 255
 
 \code
 pkfilter -i input.tif -o filter.tif -dx 3 -dy 3 -class 255 -f dilate -c
 \endcode
-Similar to previous example, but consider only values of 255 for filtering 
operation. Typical usage: dilate cloud values in input image that are flagged 
as 255
+
+\subsection examples_pkfilter_spectral Filtering in spectral/temporal domain
+
+Filtering in spectral/temporal domain. Calculate the median value for each 
pixel, calculated on a moving window of width 3 (-dz 3) over all input bands. 
The output raster dataset will contain as many bands as the input raster 
dataset.
 
 \code
 pkfilter -i input.tif -o filter_stdev.tif -dz 3 -f median
 \endcode
-Filtering in spectral/temporal domain. Calculate the median value for each 
pixel, calculated on a moving window of width 3 (-dz 3) over all input bands. 
The output raster dataset will contain as many bands as the input raster 
dataset.
+
+"Filtering" in spectral/temporal domain. No moving window (-dz 1). Calculate 
the standard deviation for each pixel, calculated on all input bands. The 
output raster dataset will contain a single band only.
 
 \code
 pkfilter -i input.tif -o filter_stdev.tif -dz 1 -f stdev
 \endcode
-"Filtering" in spectral/temporal domain. No moving window (-dz 1). Calculate 
the standard deviation for each pixel, calculated on all input bands. The 
output raster dataset will contain a single band only.
 
diff --git a/src/apps/pkdumpimg.cc b/src/apps/pkdumpimg.cc
index 3cae28f..6253e63 100644
--- a/src/apps/pkdumpimg.cc
+++ b/src/apps/pkdumpimg.cc
@@ -48,7 +48,7 @@ int main(int argc, char *argv[])
   Optionpk<double> dx_opt("dx", "dx", "Output resolution in x (in meter) (0.0: 
keep original resolution)",0.0);
   Optionpk<double> dy_opt("dy", "dy", "Output resolution in y (in meter) (0.0: 
keep original resolution)",0.0);
   Optionpk<string> resample_opt("r", "resampling-method", "Resampling method 
(near: nearest neighbour, bilinear: bi-linear interpolation).", "near");
-  Optionpk<short> dstnodata_opt("dstnodata", "dstnodata", "nodata value for 
ouptut if out of bounds.", 0);
+  Optionpk<short> dstnodata_opt("dstnodata", "dstnodata", "nodata value for 
output if out of bounds.", 0);
   Optionpk<double> srcnodata_opt("srcnodata", "srcnodata", "set no data 
value(s) for input image");
   Optionpk<short> verbose_opt("v", "verbose", "verbose (Default: 0)", 0);
 
@@ -81,7 +81,7 @@ int main(int argc, char *argv[])
   }
 
   ofstream outputStream;
-  if(!output_opt[0].empty())
+  if(!output_opt.empty())
     outputStream.open(output_opt[0].c_str());
   
   RESAMPLE theResample;
@@ -100,14 +100,19 @@ int main(int argc, char *argv[])
     exit(1);
   }
 
-  ImgWriterGdal imgWriter;
+  // ImgWriterGdal imgWriter;
   GDALDataType theType;
 
+  if(input_opt.empty()){
+    std::cerr << "No input file provided (use option -i). Use --help for help 
information" << std::endl;
+    exit(0);
+  }
+
   ImgReaderGdal imgReader(input_opt[0]);
   for(int inodata=0;inodata<srcnodata_opt.size();++inodata)
     imgReader.pushNoDataValue(srcnodata_opt[inodata]);
 
-  ImgWriterGdal virtualWriter;//only for coordinate conversion (no output file 
defined)
+  // ImgWriterGdal virtualWriter;//only for coordinate conversion (no output 
file defined)
   
   int nband=imgReader.nrOfBand();
   //get number of lines
@@ -206,7 +211,7 @@ int main(int argc, char *argv[])
   }
   double gt[6];
   imgReader.getGeoTransform(gt);
-  imgWriter.setGeoTransform(gt);
+  // imgWriter.setGeoTransform(gt);
   // imgWriter.setProjection(imgReader.getProjection());
 
   double readRow=0;
@@ -231,7 +236,8 @@ int main(int argc, char *argv[])
       double x=0;
       double y=0;
       //convert irow to geo
-      imgWriter.image2geo(0,irow,x,y);
+      // imgWriter.image2geo(0,irow,x,y);
+      imgReader.image2geo(0,irow,x,y);
       //lookup corresponding row for irow in this file
       imgReader.geo2image(x,y,readCol,readRow);
       if(readRow<0||readRow>=imgReader.nrOfRow()){
@@ -247,7 +253,8 @@ int main(int argc, char *argv[])
         else
           
imgReader.readData(readBuffer,GDT_Float64,startCol,endCol,readRow,band_opt[iband],theResample);
         for(int ib=0;ib<ncropcol;++ib){
-          assert(imgWriter.image2geo(ib,irow,x,y));
+          // assert(imgWriter.image2geo(ib,irow,x,y));
+          assert(imgReader.image2geo(ib,irow,x,y));
           //lookup corresponding row for irow in this file
           imgReader.geo2image(x,y,readCol,readRow);
           if(readCol<0||readCol>=imgReader.nrOfCol()){

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-grass/pktools.git

_______________________________________________
Pkg-grass-devel mailing list
Pkg-grass-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-grass-devel

Reply via email to