[pktools] 147/375: --projection to -a_srs in pkinfo result
Bas Couwenberg
sebastic at xs4all.nl
Wed Dec 3 21:54:08 UTC 2014
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 57d9b5da0313284e2021acd92070ece992e27a4b
Author: Pieter Kempeneers <kempenep at gmail.com>
Date: Sat Nov 30 14:07:30 2013 +0100
--projection to -a_srs in pkinfo result
---
src/apps/pkinfo.cc | 4 +-
src/apps/pksieve.cc | 107 ----------------------------------------------------
2 files changed, 2 insertions(+), 109 deletions(-)
diff --git a/src/apps/pkinfo.cc b/src/apps/pkinfo.cc
index 8d69a96..6be4183 100644
--- a/src/apps/pkinfo.cc
+++ b/src/apps/pkinfo.cc
@@ -327,9 +327,9 @@ int main(int argc, char *argv[])
}
if(projection_opt[0]){
if(imgReader.isGeoRef())
- std::cout << "--projection " << imgReader.getProjection() << " ";
+ std::cout << " -a_srs " << imgReader.getProjection() << " ";
else
- std::cout << " --projection none" << " ";
+ std::cout << " -a_srs none" << " ";
}
if(geo_opt[0]&&!read_opt[0]){
double ulx,uly,deltaX,deltaY,rot1,rot2;
diff --git a/src/apps/pksieve.cc b/src/apps/pksieve.cc
deleted file mode 100644
index 7b8dee3..0000000
--- a/src/apps/pksieve.cc
+++ /dev/null
@@ -1,107 +0,0 @@
-/**********************************************************************
-pksieve.cc: program to sieve filter raster image
-Copyright (C) 2008-2012 Pieter Kempeneers
-
-This file is part of pktools
-
-pktools is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-pktools is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with pktools. If not, see <http://www.gnu.org/licenses/>.
-***********************************************************************/
-#include "cpl_string.h"
-#include "gdal_priv.h"
-#include "gdal.h"
-#include "imageclasses/ImgReaderGdal.h"
-#include "imageclasses/ImgWriterGdal.h"
-#include "imageclasses/ImgWriterOgr.h"
-#include "base/Optionpk.h"
-#include "ogrsf_frmts.h"
-extern "C" {
-#include "gdal_alg.h"
-#include "ogr_api.h"
-}
-
-using namespace std;
-
-int main(int argc,char **argv) {
- Optionpk<string> input_opt("i", "input", "Input image file", "");
- Optionpk<string> mask_opt("m", "mask", "Mask band indicating pixels to be interpolated (zero valued) ", "");
- Optionpk<string> output_opt("o", "output", "Output image file", "");
- Optionpk<int> band_opt("b", "band", "the band to be used from input file", 0);
- Optionpk<int> connect_opt("c", "connect", "the connectedness: 4 directions or 8 directions", 8);
- Optionpk<int> size_opt("s", "size", "raster polygons with sizes smaller than this will be merged into their largest neighbour. No sieve is performed if size = 0", 0);
- Optionpk<short> verbose_opt("v", "verbose", "verbose mode if > 0", 0);
-
- bool doProcess;//stop process when program was invoked with help option (-h --help)
- try{
- doProcess=input_opt.retrieveOption(argc,argv);
- mask_opt.retrieveOption(argc,argv);
- output_opt.retrieveOption(argc,argv);
- band_opt.retrieveOption(argc,argv);
- connect_opt.retrieveOption(argc,argv);
- size_opt.retrieveOption(argc,argv);
- verbose_opt.retrieveOption(argc,argv);
- }
- catch(string predefinedString){
- std::cout << predefinedString << std::endl;
- exit(0);
- }
- if(!doProcess){
- std::cout << "short option -h shows basic options only, use long option --help to show all options" << std::endl;
- exit(0);//help was invoked, stop processing
- }
-
- GDALAllRegister();
-
- double dfComplete=0.0;
- const char* pszMessage;
- void* pProgressArg=NULL;
- GDALProgressFunc pfnProgress=GDALTermProgress;
- pfnProgress(dfComplete,pszMessage,pProgressArg);
-
- ImgReaderGdal maskReader;
- GDALRasterBand *maskBand=NULL;
- if(mask_opt[0]!=""){
- if(verbose_opt[0])
- cout << "opening mask file " << mask_opt[0] << endl;
- maskReader.open(mask_opt[0]);
- maskBand = maskReader.getRasterBand(0);
- }
-
- ImgReaderGdal inputReader(input_opt[0]);
- GDALRasterBand *inputBand;
- inputBand=inputReader.getRasterBand(band_opt[0]);
-
- ImgWriterGdal outputWriter;
- GDALRasterBand *outputBand=NULL;
- if(output_opt[0]!=""){
- if(verbose_opt[0])
- cout << "opening output file " << output_opt[0] << endl;
- outputWriter.open(output_opt[0],inputReader);
- outputBand = outputWriter.getRasterBand(0);
- //sieve filter to remove small raster elements (overwrite input band)
- if(size_opt[0]){
- if(GDALSieveFilter((GDALRasterBandH)inputBand, (GDALRasterBandH)maskBand, (GDALRasterBandH)outputBand, size_opt[0], connect_opt[0],NULL,pfnProgress,pProgressArg)!=CE_None)
- cerr << CPLGetLastErrorMsg() << endl;
- else{
- dfComplete=1.0;
- pfnProgress(dfComplete,pszMessage,pProgressArg);
- }
- }
- }
- inputReader.close();
- if(mask_opt[0]!="")
- maskReader.close();
- if(output_opt[0]!="")
- outputWriter.close();
-}
-
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/pktools.git
More information about the Pkg-grass-devel
mailing list