C#合并GeoJSON多边形集合为ArcGIS的Geometry对象

合并部分的代码:

                        Func<List<GeoJSON.Net.Geometry.IGeometryObject>, ESRI.ArcGIS.Geometry.IGeometry> MergePolygon = (lsGeometry) =>
                            {
                                ESRI.ArcGIS.Geometry.IGeometryCollection pGeoCol = new ESRI.ArcGIS.Geometry.GeometryBagClass();
                                foreach (var aGeo in lsGeometry)
                                {
                                    pGeoCol.AddGeometry(GeometryFactory.CreateEsriGeometryFromGeoJson(aGeo) as ESRI.ArcGIS.Geometry.IGeometry);
                                }
                                if (pGeoCol.GeometryCount == 0)
                                {
                                    return null;
                                }
                                ESRI.ArcGIS.Geometry.ITopologicalOperator pTopo = new ESRI.ArcGIS.Geometry.PolygonClass() as ESRI.ArcGIS.Geometry.ITopologicalOperator;
                                pTopo.ConstructUnion(pGeoCol as ESRI.ArcGIS.Geometry.IEnumGeometry);
                                pTopo.Simplify();
                                return pTopo as ESRI.ArcGIS.Geometry.IGeometry;
                            };

调用示例:

ESRI.ArcGIS.Geometry.IGeometry pShape = MergePolygon(lsGeometry);


猜你喜欢

转载自blog.csdn.net/a_dev/article/details/79709118

相关文章