1 Star 0 Fork 2

chinawingnut / Txt-ShpConverter

forked from Windragon / Txt-ShpConverter 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Txt-ShpConverter

txt和shp格式的坐标文件互转工具,使用开源库GDAL读shp文件(Text format coordinate file and shape file convert to each other, using GDAL) 下载工具

说明


本工具主要用于将txt格式的“勘测定界界址点坐标交换格式”坐标文件 与ArcGIS提供的Shapefile文件进行互转,默认支持坐标系为西安80坐标和国家2000坐标(可配置)

txt坐标文件格式规范可官方网站或百度查阅:

环境


运行环境

  • .NET Framework 2.0
  • Microsoft Visual C++ (已附带安装包Vcredist_x86.exe)

开发环境

运行


  1. 下载代码,在Visual Studio打开项目,生成项目
  2. DLL.rar(包含GDAL库的各类dll、SplitButton.dll、System.Core.dll)的全部文件解压到生成目录中;
  3. 将Data.rar的全部文件解压缩到生成目录的Data文件夹下;
  4. 启动项目

使用


WLib.CoordCoverter.RedLineManager.ShpToTxt方法将txt坐标文件转成shp文件; WLib.CoordCoverter.RedLineManager.TxtToShp方法将shp文件转成txt坐标文件; 在使用这两个坐标转换方法之前,需要先在程序启动的Main方法中调用GdalHelper.GdalInit对GDAL环境进行初始化。

using System;
using OSGeo.GDAL;
using WLib.CoordCoverter;
using WLib.CoordCoverter.Utility;
static void Main()
{
    GdalHelper.GdalInit();//初始化Gdal,注册所有驱动并支持中文
    Gdal.SetConfigOption("SHAPE_RESTORE_SHX", "YES"); //尝试还原/生成缺少的.shx文件
    
    RedLineManager.ShpToTxt(@"c:\source.shp", @"c:\result.txt");//txt转shp
    RedLineManager.TxtToShp(@"c:\source.txt", @"c:\result.shp");//shp转txt
    
    Console.WriteLine("Conversion completed!");
}
MIT License Copyright (c) 2020 Windragon Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

txt和shp格式的坐标文件互转工具,使用开源库GDAL读shp文件 展开 收起
C#
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
C#
1
https://gitee.com/chinawingnut/Txt-ShpConverter.git
git@gitee.com:chinawingnut/Txt-ShpConverter.git
chinawingnut
Txt-ShpConverter
Txt-ShpConverter
master

搜索帮助