2 Star 1 Fork 0

bouyei / ByGeo

Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Without author's permission, this code is only for learning and cannot be used for other purposes.
Clone or Download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

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);
    }
}

Repository Comments ( 0 )

Sign in to post a comment

About

地理信息处理库,包括WKT,WKB解析,图形相交,擦除等叠加分析 https://github.com/NetTopologySuite/NetTopologySuite NetTopologySuite expand collapse
C#
Cancel

Releases

No release

Contributors

All

Activities

Load More
can not load any more
C#
1
https://gitee.com/bouyei/bygeo.git
git@gitee.com:bouyei/bygeo.git
bouyei
bygeo
ByGeo
master

Search