# Error in creating line shapefile in Delphi

**URL:** <https://mapwindow.discourse.group/t/error-in-creating-line-shapefile-in-delphi/1778>\
**Category:** Uncategorized\
**Created:** [September 10, 2024, 6:24pm UTC](https://mapwindow.discourse.group/t/error-in-creating-line-shapefile-in-delphi/1778 "2024-09-10T18:24:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![msi2015](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@msi2015](https://mapwindow.discourse.group/u/msi2015)\
**Post date:** [September 10, 2024, 6:24pm UTC](https://mapwindow.discourse.group/t/error-in-creating-line-shapefile-in-delphi/1778/1 "2024-09-10T18:24:45Z")

</div>

hello everyone  
I use the MapWinGis tool in Delphi, and I have no problem creating point shapefiles from database data, but unfortunately, I encountered problems creating Polyline shapefiles.  
I used the following code for this purpose, but unfortunately, no results were obtained

procedure CreateLineShapeFile;  
var  
Shapefile: IShapefile;  
Line: IShape;  
LinePart: IShape;  
Point: IPoint;  
ErrorCode: Integer;  
FilePath: String;  
begin  
ErrorCode := 0;  
Shapefile := CoShapefile.Create;  
Shapefile.CreateNew(‘D:\LineShapeFile.shp’, SHP\_POLYLINE);  
if ErrorCode \<\> 0 then  
begin  
ShowMessage('Error creating shapefile: ’ + IntToStr(ErrorCode));  
Exit;  
end;  
Line := CoShape.Create;  
Point := CoPoint.Create;  
Point.x := 10; // X coordinate  
Point.y := 20; // Y coordinate  
Line.AddPoint(Point.x,Point.y);  
Point.x := 15; // Adjust for more points  
Point.y := 29;  
Line.AddPoint(Point.x,Point.y);  
Point.x := 18;  
Point.y := 25;  
Line.AddPoint(Point.x,Point.y);  
Shapefile.EditAddShape(Line);  
if ErrorCode \<\> 0 then  
begin  
ShowMessage('Error adding shape: ’ + IntToStr(ErrorCode));  
Exit;  
end;  
Shapefile.SaveAs(‘D:\LineShapeFile.shp’,Nil);  
ShowMessage(‘Line shapefile created successfully.’);  
end;

Please guide me to do this  
thanks
