tags:

views:

6

answers:

0

hi all i am using following code for raster to vector conversion but when i use it for 16 bit images it crashing everytime in GDALPolygonize function except i use spatial subset of the 16 bit image, so please suggest me....

here is bunch of code.......

GDALAllRegister();

OGRRegisterAll();

String pszFilename = "C:\Images\s3dImages\geo_liss.tif";

poDataset = (GDALDataset *) GDALOpen( pszFilename, GA_ReadOnly );

GDALRasterBand *poBandR,*poBandMask ;

poBandR = poDataset->GetRasterBand(1);

poBandR->CreateMaskBand(GMF_PER_DATASET);

poBandMask = poBandR->GetMaskBand() ;

poBandMask->Fill(10,0);

const char *pszDriverName = "ESRI Shapefile";

OGRSFDriver *poDriver;

poDriver = OGRSFDriverRegistrar::GetRegistrar()->GetDriverByName(pszDriverName);

OGRDataSource* ds = poDriver->CreateDataSource("Shape", NULL );

OGRLayer* poLayer = ds->CreateLayer("myfile",NULL,wkbMultiPolygon,NULL);

CPLErr er = GDALPolygonize(poBandR , poBandMask , poLayer ,1,NULL,NULL,NULL);

poLayer->SyncToDisk();

OGRDataSource::DestroyDataSource(ds);

regards chirag p.