AnsweredAssumed Answered

ArcSDE C API Issue - Buffer (SE

Question asked by deep.lakhanpal on Sep 20, 2011
Latest reply on Oct 18, 2011 by vangelo-esristaff
Hi,
I have to write a C code which will accept polygon features and create a buffer around them and store this buffer feature in a new feature of polygon type.

I am aware of the ArcSDE C API and I believe that this requirement can be completed through SE_shape_generate_buffer. But as per my code I am unable to create a buffer around the feature, instead of this buffer its copy and store the same feature in the output but the difference is that this new feature is tilted upwards.

Can anyone please help me and provide me some kind of support to complete this functionality. Please find below the code I have applied ...

##################################################################

char tps_trt[15];
char tps_trt_tuple[15];
time_t time_deb;
time_t time_deb_tuple;
time_t time_cour;
long featurecount = 0;
long result = 0;
long resultat=0;
long resultat1=0;
long lNumPoints=0;

long rc=0;
long fdp_db_rec=0;

long l_layerType=SE_AREA_TYPE_MASK|SE_MULTIPART_TYPE_MASK;
char pch_log[LG_MAX_ARG+1];

prim_shapes=(SE_SHAPE*)malloc(sizeof(SE_SHAPE)*MAX_SHAPES);
sec_shapes=(SE_SHAPE*)malloc(sizeof(SE_SHAPE)*MAX_SHAPES);
fdp_db = (SE_SHAPE *) malloc (sizeof (SE_SHAPE)* MAX_FDP_DB_RECORDS);
new_couv_shapes=(SE_SHAPE*)malloc(sizeof(SE_SHAPE)*MAX_SHAPES);
tab_coordRef=(SE_COORDREF*)malloc(sizeof(SE_COORDREF)*MAX_COORDREF);

long size_SE_SHAPE=sizeof(SE_SHAPE)*1;
/* DEBUT Initialisation du tuple */
enreg * tuple=(enreg*)malloc(sizeof(enreg));
/*****************************************************************************************************************************************************************/

ccf_initConnection_SDE(&tab_connections[0],psde_error, con_server, con_instance, con_dbase, con_user, con_pswd);

ccf_init_stream_SDE (0, &tab_connections[0],psde_error, &tab_streams[0], &tab_coordRef[0], &tab_layers[0],&tab_sqlConstruct[0], nomLayerIn, clauseWhere, NULL,l_layerType,tuple);

ccf_init_stream_SDE (1, &tab_connections[0],psde_error, &tab_streams[1], &tab_coordRef[1], &tab_layers[1],NULL, nomLayerOut, NULL, 0,l_layerType,tuple);

rc=SE_layerinfo_get_shape_types (tab_layers[0], (LONG *) &l_layerType);
/*********************************************************************************************/

long l_nbTuples = 0,ret_shapes=0;
long nb_mailles_20x20=0;
long countShapes=0;
BOOL isDisjoint_ret=TRUE;

char * var;

while ((resultat1=ccf_lire_tuple_SDE(psde_error, &tab_streams[0], tuple, &prim_shapes, &tab_coordRef[0])) == 0)
{
ccf_majTuple(tuple);

ret_shapes= SE_shape_generate_buffer (prim_shapes, 0.5, 30 , &new_couv_shapes);

tuple->tab_valChampsOut[0]=(char*) &(new_couv_shapes[0]);
ccf_ecrire_tuple_SDE (psde_error, &tab_streams[1], &tab_layers[1], tuple,&tab_coordRef[1]);

ccf_commit_SDE(&tab_connections[0],psde_error,&tab_streams[1]);
SE_shape_free(new_couv_shapes);
}


I have also reffer below mention link and tried to implement this code but didnt got any success.

http://edndoc.esri.com/arcsde/9.0/capi_concepts/shape_functions.htm


Please find attached images of output I got from this.

Outcomes