用上一篇里面 C#不用ArcEngine,生成Shp文件(二) 读取到的.shp文件信息,生成一个一样的.shp文件。测试数据下载地址为:http://download.youkuaiyun.com/detail/gis0911178/9650967
读取到的信息如下:
--------------------------------------------------------------------------------
文件长度:110
Xmin:120.062485706624
Ymin:27.752624080108
Xmax:120.102341678472
Ymax:27.7716597681547
文件记录号为:1
坐标长度为:56
几何类型:5
Box[0]:120.062485706624
Box[1]:27.752624080108
Box[2]:120.102341678472
Box[3]:27.7716597681547
子面个数:1
坐标点个数:4
每个子环在坐标点内的起始位置:
parts[0]:0
Points数组:
Points[0]:120.062485706624 27.7618444915056
Points[1]:120.102341678472 27.7716597681547
Points[2]:120.081521394671 27.752624080108
Points[3]:120.062485706624 27.7618444915056
------------------------------------------------------------------------------------------------------
按照以上信息,生成.shp文件的代码(代码下载地址http://download.youkuaiyun.com/detail/gis0911178/9598945):
string path = @shpFullNameDir;
if (!File.Exists(path))
{
using (FileStream fs = new FileStream(path, FileMode.Create,FileAccess.Write))
{
//byte[] data = new UTF8Encoding().GetBytes("abcdefg");
//fs.Write(data, 0, data.Length);
//写入FileCode
int fileCode = ChangeByteOrder(9994);
byte[] fc = System.BitConverter.GetBytes(fileCode);
fs.Seek(0,SeekOrigin.Begin);
fs.Write(fc,0,fc.Length);
//写入文件长度
int fileLength = ChangeByteOrder(110);
byte[] fl = System.BitConverter.GetBytes(fileLeng