temp = Poly;
Poly = Poly->next;
free(temp->list);
- free(temp->next);
free(temp);
}
}
int num_entities, phnshapetype,next_ring,errflg,c;
double padminbound[8], padmaxbound[8];
int u,j,tot_rings,curindex;
- SHPObject *obj;
+ SHPObject *obj=NULL;
char name[12];
char opt;
char *sr_id,*shp_file,*table, *database;
SHPGetInfo( hSHPHandle, &num_entities, &phnshapetype, &padminbound[0], &padmaxbound[0]);
- obj = SHPReadObject(hSHPHandle,0);
- trans=0;
+ if(obj == NULL){
+ obj = SHPReadObject(hSHPHandle,0);
+ if(obj == NULL){
+ printf("file exists but contains null shapes");
+ exit(-1);
+ }
+ }
+ trans=0;
+
//create the geometry column with an addgeometry call to dave's function
if(opt != 'a'){
}
- //Determine what type of shape is in the file and do appropriate processing
if (obj->nVertices == 0){
if (dump_format){
printf("\\N");
{
+ //Determine what type of shape is in the file and do appropriate processing
- if( obj->nSHPType == 5 ){
- //---------------------------------------------------------------------------------
- //---------POLYGONS----------------------------------------------------------------
+ if( obj->nSHPType == 5 ){
+ //---------------------------------------------------------------------------------
+ //---------POLYGONS----------------------------------------------------------------
// sorts of all the rings so that they are outer,inner,iner,outer,inner...
// with the inner ones coming after the outer ones they are within spatially