SHPReadObject compile error

View: New views
2 Messages — Rating Filter:   Alert me  

SHPReadObject compile error

by Jamie Lahowetz-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I get this error when compiling:
shape_test.c: In function ‘main’:
shape_test.c:24: error: incompatible types in assignment
shape_test.c:25: error: ‘SHPObject’ has no member named ‘nShapeid’

Does this mean that the shapefile does not have an id or am I just doing it wrong?

#include <shapefil.h>

int main (void)
{
    const char * shapefile = "/mnt/share/uas/GRRUVI2_uc/extractor/colorado/fe_2007_08_county";
    SHPHandle handle;
    SHPObject *shpinforead;
    int entities;
    int type;
    double minbound[4];
    double maxbound[4];
   
    printf("Location: %s\n", shapefile);
   
    handle = SHPOpen(shapefile,"rb");
    SHPGetInfo( handle,&entities,&type,minbound,maxbound);
   
    printf("Entities: %d\n",entities);
    printf("Type: %d\n",type);
    for(int i=0;i<2;printf("Min Bound: %lf\nMax Bound: %lf\n",minbound[i],maxbound[i]), i++);
   
    int a=0;
    printf("\nReading Entity %d\n",a);
    shpinforead = *SHPReadObject(handle,a);
    printf("%d %d\n",shpinforead->nShapeid,shpinforead->nParts);
   
    SHPClose(handle);
    return 0;
}

--
Jamie Ryan Lahowetz
University of Nebraska - Lincoln
Graduate Student - Geosciences
402.304.0766
jlahowetz@...

_______________________________________________
Shapelib mailing list
Shapelib@...
http://lists.maptools.org/mailman/listinfo/shapelib

Re: SHPReadObject compile error

by Frank Warmerdam-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Jamie Lahowetz wrote:
> I get this error when compiling:
> shape_test.c: In function ‘main’:
> shape_test.c:24: error: incompatible types in assignment
> shape_test.c:25: error: ‘SHPObject’ has no member named ‘nShapeid’
>
> Does this mean that the shapefile does not have an id or am I just doing
> it wrong?

Jamie,

The field name is "nShapeId" with a capital 'I'.

Best regards,

--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam@...
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

_______________________________________________
Shapelib mailing list
Shapelib@...
http://lists.maptools.org/mailman/listinfo/shapelib