[Shapelib] need help shapelib

calpas calpas calpas2007 at yahoo.fr
Mon Mar 14 03:43:18 PDT 2011


Dear all,

 this is a simple program I' writting in order to collect the shapefile type:
#include "shapelib/shapefil.h"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>

int main (int argc, char ** argv)
{
     char * filepath;
     char *  accessType;
    int *  pnEntities;
    int * pnShapeType = NULL;
        double * padfMinBound; 
    double * padfMaxBound;
    SHPHandle hSHP;
    FILE * istream;

    filepath= "/home/geotema/valatest/data/point_bycicle_sharing.shp";
    accessType= "rb";
    
    if ( (istream = fopen ( filepath, "rb" ) ) == NULL )
    {
        printf ( "file non-existant!\n" );
    }
    else
    {
        printf ( "file exists!\n" );
            
    hSHP = SHPOpen(filepath,"rb");
    
    SHPGetInfo(hSHP,pnEntities,pnShapeType, padfMinBound, padfMaxBound);
    hSHP = (SHPHandle)malloc(sizeof(SHPHandle));
    printf("hELLO World \nShape type %d\n  ", hSHP->nShapeType);
        fclose ( istream );
    }

    return 1;
}

In order to link my program with the shape lib, what I've through my Makefile.am 
is defining the following  parameters:

bin_PROGRAMS= readshapetest
readshapetest_SOURCES = readshapetest.c shapelib/shpopen.c shapelib/shapefil.h 
clean:
    rm -f *.o *.c

the compiling step is successful, unfortunately I'm keeping on having 0 as 
output. can you please tell me where I'm failing

Cheers.......


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/shapelib/attachments/20110314/3a0b451c/attachment.html>


More information about the Shapelib mailing list