Skip to content

Commit

Permalink
added -where and progress func
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.osgeo.org/gdal/trunk@8746 f0d54148-0727-0410-94bb-9a71ac55c965
  • Loading branch information
warmerdam committed Oct 28, 2005
1 parent c9ff6ad commit aae7494
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions apps/gdal_rasterize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
******************************************************************************
*
* $Log$
* Revision 1.2 2005/10/28 18:31:09 fwarmerdam
* added -where and progress func
*
* Revision 1.1 2005/10/28 17:47:50 fwarmerdam
* New
*
Expand Down Expand Up @@ -55,7 +58,7 @@ static void Usage()
" [-burn value] | [-a attribute_name] | [-3d]\n"
// " [-of format_driver] [-co key=value]\n"
// " [-te xmin ymin xmax ymax] [-tr xres yres] [-ts width height]\n"
" [-l layername]* [-sql select_statement]\n"
" [-l layername]* [-where expression] [-sql select_statement]\n"
" <src_datasource> <dst_filename>\n" );
exit( 1 );
}
Expand Down Expand Up @@ -131,7 +134,8 @@ static void ProcessLayer(
/* -------------------------------------------------------------------- */
GDALRasterizeGeometries( hDstDS, anBandList.size(), &(anBandList[0]),
ahGeometries.size(), &(ahGeometries[0]),
NULL, NULL, &(adfFullBurnValues[0]), NULL );
NULL, NULL, &(adfFullBurnValues[0]), NULL,
GDALTermProgress, NULL );

/* -------------------------------------------------------------------- */
/* Cleanup geometries. */
Expand All @@ -155,6 +159,7 @@ int main( int argc, char ** argv )
char **papszLayers = NULL;
const char *pszSQL = NULL;
const char *pszBurnAttribute = NULL;
const char *pszWHERE = NULL;
std::vector<int> anBandList;
std::vector<double> adfBurnValues;

Expand Down Expand Up @@ -186,6 +191,10 @@ int main( int argc, char ** argv )
{
adfBurnValues.push_back( atof(argv[++i]) );
}
else if( EQUAL(argv[i],"-where") && i < argc-1 )
{
pszWHERE = argv[++i];
}
else if( EQUAL(argv[i],"-l") && i < argc-1 )
{
papszLayers = CSLAddString( papszLayers, argv[++i] );
Expand Down Expand Up @@ -266,6 +275,12 @@ int main( int argc, char ** argv )
continue;
}

if( pszWHERE )
{
if( OGR_L_SetAttributeFilter( hLayer, pszWHERE ) != OGRERR_NONE )
break;
}

ProcessLayer( hLayer, hDstDS, anBandList,
adfBurnValues, b3D, pszBurnAttribute );
}
Expand Down

0 comments on commit aae7494

Please sign in to comment.