# ByGeo **Repository Path**: bouyei/bygeo ## Basic Information - **Project Name**: ByGeo - **Description**: 地理信息处理库,包括WKT,WKB解析,图形相交,擦除等叠加分析 https://github.com/NetTopologySuite/NetTopologySuite NetTopologySuite - **Primary Language**: C# - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 1 - **Created**: 2020-12-09 - **Last Updated**: 2024-07-30 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # ByGeo #### 介绍 地理信息处理库,包括WKT,WKB解析,图形相交,擦除等叠加分析 https://github.com/NetTopologySuite/NetTopologySuite NetTopologySuite #### 软件架构 NetTopologySuite #### 安装教程 1. nuget Install-Package ByGeo #### 使用说明 static void WKTIntersection() { var wkt1 = File.ReadAllText("E:\\g1.wkt"); var wkt2 = File.ReadAllText("E:\\g2.wkt"); Geometry geo1 = new WKTReader().Read(wkt1); Geometry geo2 = new WKTReader().Read(wkt2); //验证要素是否有效,为空或者有自相交则无效 if (geo1.IsValid == false) { return; } if (geo2.IsValid == false) { return; } //是否检查节点有效,如果存在自相交等则相交失败 // ByGeo.Operation.Overlay.OverlayOp.NodingValidatorDisabled = true; var result = geo1.Intersection(geo2); var resultstr = new WKTWriter().Write(result); By.GeometryEllipse ellipse = new By.GeometryEllipse(); double nArea = ellipse.Area(resultstr); Console.WriteLine(resultstr); } static void EllipseArea() { var g1 = "POLYGON ((105.66278148717595 26.268896196702144,105.65603151224457 26.270494874738745,105.6553345349609 26.27166525334883,105.65733907973481 26.273402525905908,105.6625862344672 26.271431379254807,105.66278148717595 26.268896196702144))";// File.ReadAllText("E:\\g1.wkt"); Geometry geo1 = new WKTReader().Read(g1); double gArea = geo1.Area;//平面面积,所以必须是平面坐标系 //wkt var text = geo1.AsText(); By.GeometryEllipse ellipse = new By.GeometryEllipse(); double nArea = ellipse.Area(text); } }