public void Buffer_ByRegionSegment()
        {
            string serviceUrl = string.Format("http://{0}:8090/iserver/services/spatialanalyst-changchun/restjsr", ip);
            SpatialAnalyst spatialAnalyst = new SpatialAnalyst(serviceUrl);

            BufferAnalystParameter bufferAnalystParameter = new BufferAnalystParameter();
            bufferAnalystParameter.EndType = BufferEndType.ROUND;
            bufferAnalystParameter.SemicircleLineSegment = 12;
            bufferAnalystParameter.LeftDistance = new BufferDistance() { Value = 2 };
            bufferAnalystParameter.RightDistance = new BufferDistance() { Value = 55557 };

            Geometry geometry = new Geometry();
            geometry.Type = GeometryType.REGION;
            Point2D point1 = new Point2D(23, 23);
            Point2D point2 = new Point2D(33, 37);
            Point2D point3 = new Point2D(33, 38);
            geometry.Points = new Point2D[] { point1, point2, point3 };
            geometry.Parts = new int[] { 3 };

            GeometrySpatialAnalystResult result = spatialAnalyst.Buffer(geometry, bufferAnalystParameter);
            Assert.IsNotNull(result);
            Assert.IsTrue(result.Succeed);
            Assert.IsTrue(result.ResultGeometry != null);
            Assert.IsTrue(result.ResultGeometry.Type == GeometryType.REGION);
            Assert.IsTrue(result.ResultGeometry.Points.Length == 98);
        }
        public void Buffer_ByPoint()
        {
            string serviceUrl = string.Format("http://{0}:8090/iserver/services/spatialanalyst-changchun/restjsr", ip);
            SpatialAnalyst spatialAnalyst = new SpatialAnalyst(serviceUrl);

            BufferAnalystParameter bufferAnalystParameter = new BufferAnalystParameter();
            bufferAnalystParameter.EndType = BufferEndType.ROUND;
            bufferAnalystParameter.SemicircleLineSegment = 4;
            bufferAnalystParameter.LeftDistance = new BufferDistance() { Value = 105.2 };
            bufferAnalystParameter.RightDistance = new BufferDistance() { Value = 105.2 };

            Geometry geometry = new Geometry();
            geometry.Type = GeometryType.POINT;
            Point2D point1 = new Point2D(23, 23);
            Point2D point2 = new Point2D(33, 37);
            geometry.Points = new Point2D[] { point1 };
            geometry.Parts = new int[] { 1 };

            GeometrySpatialAnalystResult result = spatialAnalyst.Buffer(geometry, bufferAnalystParameter);

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

            BufferAnalystParameter bufferAnalystParameter = new BufferAnalystParameter();
            bufferAnalystParameter.EndType = BufferEndType.FLAT;
            bufferAnalystParameter.SemicircleLineSegment = 4;
            bufferAnalystParameter.LeftDistance = new BufferDistance() { Value = 105.2 };
            bufferAnalystParameter.RightDistance = new BufferDistance() { Value = 105.2 };

            QueryParameter filterQueryParameter = new QueryParameter();
            filterQueryParameter.AttributeFilter = "smid=5 or smid =1";

            BufferResultSetting bufferResultSetting = new BufferResultSetting();
            bufferResultSetting.DataReturnOption = new DataReturnOption()
            {
                Dataset = "resultLine",
                DataReturnMode = DataReturnMode.DATASET_AND_RECORDSET,
                DeleteExistResultDataset = true
            };
            bufferResultSetting.IsAttributeRetained = true;

            try
            {
                DatasetSpatialAnalystResult result = spatialAnalyst.Buffer("Edit_Line@Changchun", bufferAnalystParameter, filterQueryParameter, bufferResultSetting);
            }
            catch (ServiceException e)
            {
                Assert.IsTrue(true);
                Assert.IsTrue(e.Code == 400);
            }
        }
        public void Buffer_ByPolygonDatasetUnion()
        {
            string serviceUrl = string.Format("http://{0}:8090/iserver/services/spatialanalyst-changchun/restjsr", ip);
            SpatialAnalyst spatialAnalyst = new SpatialAnalyst(serviceUrl);

            BufferAnalystParameter bufferAnalystParameter = new BufferAnalystParameter();
            bufferAnalystParameter.EndType = BufferEndType.ROUND;
            bufferAnalystParameter.SemicircleLineSegment = 4;
            bufferAnalystParameter.LeftDistance = new BufferDistance() { Value = 105.2 };
            bufferAnalystParameter.RightDistance = new BufferDistance() { Value = 105.2 };

            BufferResultSetting bufferResultSetting = new BufferResultSetting();
            bufferResultSetting.DataReturnOption = new DataReturnOption()
            {
                Dataset = "resultPolygon",
                DataReturnMode = DataReturnMode.DATASET_AND_RECORDSET,
                DeleteExistResultDataset = true
            };
            bufferResultSetting.IsAttributeRetained = true;
            bufferResultSetting.IsUnion = true;
            try
            {
                DatasetSpatialAnalystResult result = spatialAnalyst.Buffer("WaterPoly@Changchun", bufferAnalystParameter, null, bufferResultSetting);

                Assert.IsTrue(result != null);
                Assert.IsTrue(result.Succeed);
                Assert.IsTrue(result.Dataset == "resultPolygon@Changchun");
                Assert.IsTrue(result.Recordset != null);
                Assert.IsTrue(result.Recordset.Features != null);
                Assert.IsTrue(result.Recordset.Features.Length == 1);
            }
            catch (ServiceException e)
            {
                Assert.IsTrue(true);
                Assert.IsTrue(e.Code == 400);
            }
            finally
            {

            }
        }
        public void Buffer_ByLineDatasetHasAttributerFilter()
        {
            string serviceUrl = string.Format("http://{0}:8090/iserver/services/spatialanalyst-changchun/restjsr", ip);
            SpatialAnalyst spatialAnalyst = new SpatialAnalyst(serviceUrl);

            BufferAnalystParameter bufferAnalystParameter = new BufferAnalystParameter();
            bufferAnalystParameter.EndType = BufferEndType.ROUND;
            bufferAnalystParameter.SemicircleLineSegment = 4;
            bufferAnalystParameter.LeftDistance = new BufferDistance() { Value = 105.2 };
            bufferAnalystParameter.RightDistance = new BufferDistance() { Value = 105.2 };

            QueryParameter filterQueryParameter = new QueryParameter();
            filterQueryParameter.AttributeFilter = "smid=5 or smid =1";

            BufferResultSetting bufferResultSetting = new BufferResultSetting();
            bufferResultSetting.DataReturnOption = new DataReturnOption()
            {
                Dataset = "resultLine",
                DataReturnMode = DataReturnMode.DATASET_AND_RECORDSET,
                DeleteExistResultDataset = true
            };
            bufferResultSetting.IsAttributeRetained = true;

            DatasetSpatialAnalystResult result = spatialAnalyst.Buffer("Edit_Line@Changchun", bufferAnalystParameter, filterQueryParameter, bufferResultSetting);

            Assert.IsNotNull(result);
            Assert.IsTrue(result.Succeed);
            Assert.IsTrue(result.Dataset == "resultLine@Changchun");
            Assert.IsTrue(result.Recordset != null);
            Assert.IsTrue(result.Recordset.Features != null);
            Assert.IsTrue(result.Recordset.Features.Length == 1);
        }