Hi,<br><br>I am new to shapelib. I want to create a simple shp file. I
want to draw point on specific latitude and longitude. I tried to
execute the following code which I found by google research.<br>I
successfully create the shp file and viewed it by ShapeViewer but I
found my dbf file empty. I am wondering if data in dbf file is created
while creating new shp file or should it be created<br>
manually? If so how can I link shp and dbf file. Basically I want to
apply some rule on dbf file. Can anyone help me please. Here I attach my
sample code.<br><br><br> #include "stdafx.h"<br> #include <iostream<br>
#include <cstdlib<br> #include "shapefil.h"<br> #include <string<br><br> using namespace std;<br><br> int _tmain(int argc, _TCHAR* argv[])<br> {<br> SHPHandle hSHP;<br> DBFHandle hDBF;<br> int nShapeType, Vertices;<br>
string shape_name, Col1;<br> SHPObject *psObject;<br><br> double X[3], Y[3];<br><br> X[0] = -130;<br> Y[0]= 54;<br> <br> X[1] = -120;<br> Y[1]= 30;<br> <br> X[2] = -100;<br> Y[2]= 10;<br>
<br> nShapeType = MultiPoint;<br> Vertices = 3;<br><br><br> hSHP = SHPCreate( "T:\\shapefolder\\test.shp",<div id=":7h">nShapeType);<br><br> hDBF = DBFCreate(T:\\shapefolder\\test.dbf);<br>
<br> psObject = SHPCreateSimpleObject( nShapeType, Vertices, X, Y, NULL);<br>
SHPWriteObject( hSHP, -1, psObject );<br><br><br> DBFClose( hDBF );<br> SHPClose( hSHP );<br><br><br><br> return 0;<br> }</div>