public void DatasetAndGeometryOverlay_IntersectHasSourceFilter()
        {
            string serviceUrl = string.Format("http://{0}:8090/iserver/services/spatialanalyst-overlay/restjsr", ip);
            SpatialAnalyst spatialAnalyst = new SpatialAnalyst(serviceUrl);
            string sourceDataset = "Sdzzd_P@overlay";
            string returnDatasetName = "PointAndCustomRegionOverlay";

            Point2D point1 = new Point2D(-119275.149508913, 2797273.49481734);
            Point2D point2 = new Point2D(2205422.68158318, 2797273.49481734);
            Point2D point3 = new Point2D(2205422.68158318, 3750228.67190104);
            Point2D point4 = new Point2D(-119275.149508913, 3750228.67190104);
            Geometry region = new Geometry()
            {
                Type = GeometryType.RECTANGLE,
                Parts = new int[] { 4 },
                Points = new Point2D[] { point1, point2, point3, point4 }
            };

            DatasetOverlayResultSetting resultSetting = new DatasetOverlayResultSetting()
            {
                DataReturnOption = new DataReturnOption()
                {
                    Dataset = returnDatasetName,
                    DeleteExistResultDataset = true,
                    DataReturnMode = DataReturnMode.DATASET_AND_RECORDSET
                },
                Tolerance = 5,
            };

            QueryParameter sourceDatasetFilter = new QueryParameter()
            {
                Ids = new int[] { 159, 1272 },
            };

            Geometry[] operateRegions = new Geometry[] { region };
            DatasetSpatialAnalystResult result = spatialAnalyst.Overlay(sourceDataset, sourceDatasetFilter, operateRegions, OverlayOperationType.INTERSECT, resultSetting);
            Assert.IsNotNull(result);
            Assert.IsTrue(!string.IsNullOrWhiteSpace(result.Dataset));
            Assert.IsTrue(result.Recordset.Features[0].Geometry.Type == GeometryType.POINT);
        }
        public void DatasetOverlay_IntersectLineAndPoint()
        {
            string serviceUrl = string.Format("http://{0}:8090/iserver/services/spatialanalyst-overlay/restjsr", ip);
            SpatialAnalyst spatialAnalyst = new SpatialAnalyst(serviceUrl);
            string sourceDataset = "Sdzzd_P@overlay";
            string operateDataset = "Road_L@overlay";
            string returnDatasetName = "LineAndPointOverlay";

            DatasetOverlayResultSetting resultSetting = new DatasetOverlayResultSetting()
            {
                DataReturnOption = new DataReturnOption()
                {
                    Dataset = returnDatasetName,
                    DeleteExistResultDataset = true,
                    DataReturnMode = DataReturnMode.DATASET_AND_RECORDSET
                },
                Tolerance = 5,
            };

            try
            {
                DatasetSpatialAnalystResult result = spatialAnalyst.Overlay(sourceDataset, null, operateDataset, null, OverlayOperationType.INTERSECT, resultSetting);

            }
            catch (ServiceException e)
            {
                Assert.IsTrue(e.Code == 400);
                Assert.IsTrue(e.Message == "错误的叠加数据集类型。");
            }
        }
        public void DatasetAndGeometryOverlay_Intersect()
        {
            string serviceUrl = string.Format("http://{0}:8090/iserver/services/spatialanalyst-overlay/restjsr", ip);
            SpatialAnalyst spatialAnalyst = new SpatialAnalyst(serviceUrl);
            string sourceDataset = "Sdzzd_P@overlay";
            string returnDatasetName = "LineAndPointOverlay";

            Point2D point1 = new Point2D(-119275.149508913, 2797273.49481734);
            Point2D point2 = new Point2D(2205422.68158318, 2797273.49481734);
            Point2D point3 = new Point2D(2205422.68158318, 3750228.67190104);
            Point2D point4 = new Point2D(-119275.149508913, 3750228.67190104);
            Geometry region = new Geometry()
            {
                Type = GeometryType.RECTANGLE,
                Parts = new int[] { 4 },
                Points = new Point2D[] { point1, point2, point3, point4 }
            };

            Geometry[] operateRegions = new Geometry[] { region };
            DatasetSpatialAnalystResult result = spatialAnalyst.Overlay(sourceDataset, operateRegions, OverlayOperationType.INTERSECT);
            Assert.IsNotNull(result);
            Assert.IsTrue(!string.IsNullOrWhiteSpace(result.Dataset));
        }
        public void DatasetOverlay_IntersectRegionAndLine()
        {
            string serviceUrl = string.Format("http://{0}:8090/iserver/services/spatialanalyst-overlay/restjsr", ip);
            SpatialAnalyst spatialAnalyst = new SpatialAnalyst(serviceUrl);
            string sourceDataset = "Road_L@overlay";
            string operateDataset = "Provices_Part@overlay";
            string returnDatasetName = "RegionAndLineOverlay";

            DatasetOverlayResultSetting resultSetting = new DatasetOverlayResultSetting()
            {
                DataReturnOption = new DataReturnOption()
                {
                    Dataset = returnDatasetName,
                    DeleteExistResultDataset = true,
                    DataReturnMode = DataReturnMode.DATASET_AND_RECORDSET
                },
                Tolerance = 5,
            };

            DatasetSpatialAnalystResult result = spatialAnalyst.Overlay(sourceDataset, null, operateDataset, null, OverlayOperationType.INTERSECT, resultSetting);
            Assert.IsNotNull(result);
            Assert.IsTrue(result.Succeed);
            Assert.IsTrue(result.Recordset.Features[0].Geometry.Type == GeometryType.LINE);
        }
        public void DatasetOverlay_IntersectOperateDatasetHasFilter()
        {
            string serviceUrl = string.Format("http://{0}:8090/iserver/services/spatialanalyst-overlay/restjsr", ip);
            SpatialAnalyst spatialAnalyst = new SpatialAnalyst(serviceUrl);
            string sourceDataset = "Lake_R@overlay";
            string operateDataset = "Provices_Part@overlay";
            string returnDatasetName = "polygonOverlay";

            DatasetOverlayResultSetting resultSetting = new DatasetOverlayResultSetting()
            {
                DataReturnOption = new DataReturnOption()
                {
                    Dataset = returnDatasetName,
                    DeleteExistResultDataset = true,
                    DataReturnMode = DataReturnMode.DATASET_AND_RECORDSET
                },
                Tolerance = 5,
            };

            QueryParameter sourceDatasetFilter = new QueryParameter()
            {
                AttributeFilter = "smid=79",
            };

            QueryParameter operateDatasetFilter = new QueryParameter()
            {
                AttributeFilter = "smid=1",
            };

            DatasetSpatialAnalystResult result = spatialAnalyst.Overlay(sourceDataset, sourceDatasetFilter, operateDataset, operateDatasetFilter, OverlayOperationType.INTERSECT, resultSetting);
            Assert.IsNotNull(result);
            Assert.IsTrue(result.Recordset.Features.Length == 0);
        }
        public void DatasetOverlay_IntersectByCustomName()
        {
            string serviceUrl = string.Format("http://{0}:8090/iserver/services/spatialanalyst-overlay/restjsr", ip);
            SpatialAnalyst spatialAnalyst = new SpatialAnalyst(serviceUrl);

            string sourceDataset = "Lake_R@overlay";
            string operateDataset = "Provices_Part@overlay";
            string returnDatasetName = "polygonOverlay";

            DatasetOverlayResultSetting resultSetting = new DatasetOverlayResultSetting()
            {
                DataReturnOption = new DataReturnOption()
                {
                    Dataset = returnDatasetName,
                    DeleteExistResultDataset = true,
                    DataReturnMode = DataReturnMode.DATASET_AND_RECORDSET
                },
                Tolerance = 5,
            };

            DatasetSpatialAnalystResult result = spatialAnalyst.Overlay(sourceDataset, null, operateDataset, null, OverlayOperationType.INTERSECT, resultSetting);
            Assert.IsNotNull(result);
            Assert.IsTrue(result.Succeed);
            Assert.IsTrue(result.Dataset == returnDatasetName + "@overlay");
            Assert.IsNotNull(result.Recordset);
            Assert.IsTrue(result.Recordset.Features.Length == 61);
        }
        public void DatasetOverlay_Intersect()
        {
            string serviceUrl = string.Format("http://{0}:8090/iserver/services/spatialanalyst-overlay/restjsr", ip);
            SpatialAnalyst spatialAnalyst = new SpatialAnalyst(serviceUrl);

            string sourceDataset = "Lake_R@overlay";
            string operateDataset = "Provices_Part@overlay";

            DatasetSpatialAnalystResult result = spatialAnalyst.Overlay(sourceDataset, operateDataset, OverlayOperationType.INTERSECT);

            Assert.IsNotNull(result);
            Assert.IsTrue(result.Succeed);
        }
        public void GeometryOverlay_Intersect()
        {
            string serviceUrl = string.Format("http://{0}:8090/iserver/services/spatialanalyst-overlay/restjsr", ip);
            SpatialAnalyst spatialAnalyst = new SpatialAnalyst(serviceUrl);

            Point2D point1 = new Point2D(-119275.149508913, 2797273.49481734);
            Point2D point2 = new Point2D(2205422.68158318, 2797273.49481734);
            Point2D point3 = new Point2D(2205422.68158318, 3750228.67190104);
            Point2D point4 = new Point2D(-119275.149508913, 3750228.67190104);
            Geometry sourceGeometry = new Geometry()
            {
                Type = GeometryType.REGION,
                Parts = new int[] { 5 },
                Points = new Point2D[] { point1, point2, point3, point4, point1 }
            };


            Point2D point11 = new Point2D(106354.179627901, 3346414.71476035);
            Point2D point21 = new Point2D(2218343.65146419, 3346414.71476035);
            Point2D point31 = new Point2D(2218343.65146419, 4299369.89184406);
            Point2D point41 = new Point2D(106354.179627901, 4299369.89184406);
            Geometry operateGeometry = new Geometry()
            {
                Type = GeometryType.REGION,
                Parts = new int[] { 5 },
                Points = new Point2D[] { point11, point21, point31, point41, point11 }
            };

            GeometrySpatialAnalystResult result = spatialAnalyst.Overlay(sourceGeometry, operateGeometry, OverlayOperationType.INTERSECT);
            Assert.IsNotNull(result);
            Assert.IsTrue(result.Succeed);
            Assert.IsTrue(result.ResultGeometry != null);
            Assert.IsTrue(result.ResultGeometry.Type == GeometryType.REGION);
        }