91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 15.29MB
    文件類型: .rar
    金幣: 1
    下載: 0 次
    發布日期: 2023-06-18
  • 語言: C#
  • 標簽: GDALWKT??

資源簡介

C# GDAL 2.1.0讀取Shapefile并將Shape轉換為WKT源碼

資源截圖

代碼片段和文件信息

using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Windows.Forms;
using?System.IO;

namespace?WKTConvert
{
????public?partial?class?Form1?:?Form
????{
????????public?Form1()
????????{
????????????InitializeComponent();
????????}

????????private?string?wktString;

????????public?string?WktString
????????{
????????????get?{?return?wktString;?}
????????????set?{?wktString?=?value;?}
????????}

????????///?
????????///?讀取Shapefile?shp信息
????????///?

????????///?Shapefile路徑
????????///?shp信息
????????public?string?ReadSHP(string?path)
????????{
????????????string?strMessage?=?““;

????????????OSGeo.OGR.Ogr.RegisterAll();
????????????OSGeo.OGR.Driver?dr?=?OSGeo.OGR.Ogr.GetDriverByName(“ESRI?shapefile“);

????????????if?(dr?==?null)
????????????{
????????????????MessageBox.Show(“文件不能打開,請檢查“);
????????????????return?““;
????????????}

????????????OSGeo.OGR.DataSource?ds?=?dr.Open(path?0);
????????????int?layerCount?=?ds.GetlayerCount();

????????????OSGeo.OGR.layer?layer?=?ds.GetlayerByIndex(0);

????????????//投影信息
????????????OSGeo.OSR.SpatialReference?coord?=?layer.GetSpatialRef();
????????????string?coordString;
????????????coord.ExportToWkt(out?coordString);

????????????OSGeo.OGR.Feature?feat;
????????????//string?contentString?=?““;
????????????string?wkt;
????????????string?strWkt?=?string.Empty;
????????????//讀取shp文件
????????????while?((feat?=?layer.GetNextFeature())?!=?null)
????????????{
????????????????OSGeo.OGR.Geometry?geometry?=?feat.GetGeometryRef();
????????????????OSGeo.OGR.wkbGeometryType?goetype?=?geometry.GetGeometryType();
????????????????geometry.ExportToWkt(out?wkt);
????????????????strWkt?+=?wkt?+?“\n“;?????????????
????????????}

????????????strMessage?+=?“該文件有:“?+?layerCount?+?“層“;
????????????strMessage?+=?Environment.NewLine;
????????????strMessage?+=?“該文件坐標信息為:“?+?coordString;
????????????strMessage?+=?Environment.NewLine;
????????????strMessage?+=?“幾何類型:“?+?layer.GetGeomType();//shp的類型
????????????strMessage?+=?Environment.NewLine;
????????????strMessage?+=?“該文件共有:“?+?layer.GetFeatureCount(0).ToString()?+?“記錄“;
????????????strMessage?+=?Environment.NewLine;
????????????strMessage?+=?strWkt;
????????????return?strMessage;
????????}

????????private?void?btnSelect_Click(object?sender?EventArgs?e)
????????{
????????????using?(OpenFileDialog?ofg?=?new?OpenFileDialog())
????????????{
????????????????ofg.InitialDirectory?=?Path.GetFullPath(“../../World“);
????????????????ofg.Filter?=?“Shapefile(*.shp)|*.shp“;
????????????????if?(ofg.ShowDialog()?==?DialogResult.OK)
????????????????{
????????????????????txtInput.Text?=?ofg.FileName;
????????????????}
????????????}
????????}

????????private?void?btnConvertToWkt_Click(object?sender?EventArgs?e)
????????{
??

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件????????144??2016-05-04?10:10??WKTConvert\app.config

?????文件????1826304??2015-11-23?02:50??WKTConvert\bin\Debug\cairo.dll

?????文件????1001472??2015-11-23?02:06??WKTConvert\bin\Debug\cfitsio.dll

?????文件?????118272??2015-11-23?04:32??WKTConvert\bin\Debug\expat.dll

?????文件??????50688??2015-11-23?01:07??WKTConvert\bin\Debug\freexl.dll

?????文件?????110592??2015-11-23?02:19??WKTConvert\bin\Debug\fribidi.dll

?????文件????9694208??2015-11-26?05:27??WKTConvert\bin\Debug\gdal111.dll

?????文件??????19456??2015-11-26?05:30??WKTConvert\bin\Debug\gdalconst_csharp.dll

?????文件??????12288??2015-11-26?05:30??WKTConvert\bin\Debug\gdalconst_wrap.dll

?????文件??????80384??2015-11-26?05:30??WKTConvert\bin\Debug\gdal_csharp.dll

?????文件?????110592??2015-11-26?05:30??WKTConvert\bin\Debug\gdal_wrap.dll

?????文件????1018880??2015-11-23?01:04??WKTConvert\bin\Debug\geos.dll

?????文件?????228864??2015-11-23?01:04??WKTConvert\bin\Debug\geos_c.dll

?????文件?????898048??2015-11-23?01:07??WKTConvert\bin\Debug\iconv.dll

?????文件?????288256??2015-11-23?01:43??WKTConvert\bin\Debug\libcurl.dll

?????文件????1158144??2015-11-23?01:34??WKTConvert\bin\Debug\libeay32.dll

?????文件????1026560??2015-11-25?03:30??WKTConvert\bin\Debug\libecwj2.dll

?????文件??????38912??2015-11-23?02:10??WKTConvert\bin\Debug\libfcgi.dll

?????文件?????350208??2015-11-23?03:35??WKTConvert\bin\Debug\libkea.dll

?????文件????3871232??2015-11-23?03:53??WKTConvert\bin\Debug\libmysql.dll

?????文件?????119296??2015-11-23?01:54??WKTConvert\bin\Debug\libpq.dll

?????文件?????719872??2015-11-23?02:25??WKTConvert\bin\Debug\libtiff.dll

?????文件????1005056??2015-11-23?02:04??WKTConvert\bin\Debug\libxml2.dll

?????文件????3752960??2014-06-19?19:39??WKTConvert\bin\Debug\lti_dsdk_9.1.dll

?????文件?????287232??2014-06-19?19:21??WKTConvert\bin\Debug\lti_lidar_dsdk_1.1.dll

?????文件????2296832??2015-11-26?05:38??WKTConvert\bin\Debug\mapserver.dll

?????文件?????108544??2015-11-23?03:45??WKTConvert\bin\Debug\mfhdfdll.dll

?????文件?????421200??2011-06-11?08:58??WKTConvert\bin\Debug\msvcp100.dll

?????文件?????773968??2011-06-11?08:58??WKTConvert\bin\Debug\msvcr100.dll

?????文件????7518144??2014-03-11?01:16??WKTConvert\bin\Debug\NCSEcw.dll

............此處省略104個文件信息

評論

共有 條評論

相關資源