コード例 #1
0
        public static IGeometry Project(IGeometry geometry, ProjectionInfo pStart, ProjectionInfo pEnd)
        {
            var featureSet = new FeatureSet();

            featureSet.AddFeature(geometry.ToDotSpatial());
            featureSet.Projection = pStart;
            featureSet.Reproject(pEnd);
            return
                (GeometryConverter.ToGeoAPI(
                     ((featureSet.Features[0].BasicGeometry as DotSpatial.Topology.IGeometry))));
        }
コード例 #2
0
        public static List <IGeometry> Project(List <IGeometry> toList, ProjectionInfo pStart, ProjectionInfo pEnd)
        {
            var geometryCollection = new GeometryCollection(toList.ToArray());
            var collection         = geometryCollection.ToDotSpatial();
            var featureSet         = new FeatureSet();

            foreach (var geo in collection.Geometries)
            {
                featureSet.Features.Add(geo);
            }
            featureSet.Projection = pStart;
            featureSet.Reproject(pEnd);
            var dotSpatialProjectedGeos =
                featureSet.Features.Select(x => x.BasicGeometry as DotSpatial.Topology.IGeometry).ToList();
            var result =
                dotSpatialProjectedGeos.Select(
                    dotSpatialProjectedGeo => GeometryConverter.ToGeoAPI((dotSpatialProjectedGeo)))
                .ToList();

            return(result);
        }