Esempio n. 1
0
        public virtual async Task <List <Feature <T> > > Project <T>(ProjectGeometry <T> operation, CancellationToken ct = default(CancellationToken)) where T : IGeometry
        {
            var projected = await Post <GeometryOperationResponse <T>, ProjectGeometry <T> >(operation, ct).ConfigureAwait(false);

            if (ct.IsCancellationRequested)
            {
                return(null);
            }

            var result = operation.Features.UpdateGeometries <T>(projected.Geometries);

            if (result.First().Geometry.SpatialReference == null)
            {
                result.First().Geometry.SpatialReference = operation.OutputSpatialReference;
            }
            return(result);
        }
Esempio n. 2
0
        /// <summary>
        /// Projects the list of geometries passed in using the GeometryServer
        /// </summary>
        /// <typeparam name="T">The type of the geometries</typeparam>
        /// <param name="features">A collection of features which will have their geometries projected</param>
        /// <param name="outputSpatialReference">The spatial reference you want the result set to be</param>
        /// <param name="ct">Optional cancellation token to cancel pending request</param>
        /// <returns>The corresponding features with the newly projected geometries</returns>
        public virtual async Task <List <Feature <T> > > Project <T>(List <Feature <T> > features, SpatialReference outputSpatialReference, CancellationToken ct) where T : IGeometry
        {
            var op        = new ProjectGeometry <T>(GeometryServiceEndpoint, features, outputSpatialReference);
            var projected = await Post <GeometryOperationResponse <T>, ProjectGeometry <T> >(op, ct);

            if (ct.IsCancellationRequested)
            {
                return(null);
            }

            var result = features.UpdateGeometries <T>(projected.Geometries);

            if (result.First().Geometry.SpatialReference == null)
            {
                result.First().Geometry.SpatialReference = outputSpatialReference;
            }
            return(result);
        }