/**
         * Creates a new SRS from an ESRI-style WKT/PRJ string.
         *
         * @param wkt
         *      ESRI-style WKT (well-known text) SRS definition
         * @return
         *      A spatial reference. Caller is responsible for deleting
         *      the return object.
         */
        public SpatialReference createSRSfromESRI(string wkt)
        {
            SpatialReference result = null;

            //SetUp coordinate transformation
            ProjNet.CoordinateSystems.CoordinateSystemFactory csf = new ProjNet.CoordinateSystems.CoordinateSystemFactory();
            cs = csf.CreateFromWkt(wkt);
            throw new NotImplementedException();
        }
Пример #2
0
        /// <summary>Creates a new instance of the <see cref="CoordinateSystem" /> class.</summary>
        /// <param name="system">The original system to encapsulate.</param>
        internal CoordinateSystem(ProjNetCS.ICoordinateSystem system)
        {
            Debug.Assert(system != null);
            if (system == null)
            {
                throw new ArgumentNullException("system");
            }

            _System = system;
        }
        public SpatialReference createSRSfromWKT(string wkt, ICoordinateSystem source)
        {
            SpatialReference result = null;

            //SetUp coordinate transformation
            ProjNet.CoordinateSystems.CoordinateSystemFactory csf = new ProjNet.CoordinateSystems.CoordinateSystemFactory();
            cs = csf.CreateFromWkt(wkt);
            ProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory ctf = new ProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory();
            ctf.CreateFromCoordinateSystems(source, cs);
            ProjNet.CoordinateSystems.Transformations.ICoordinateTransformation ct = ctf.CreateFromCoordinateSystems(cs, source);
            //crear SharpMapSpatialReference usando el coordinateTranformation.
            throw new NotImplementedException();
        }
        public SpatialReference createSRSfromWKT(string wkttarget, string wktsource)
        {
            ProjNet.CoordinateSystems.CoordinateSystemFactory csf      = new ProjNet.CoordinateSystems.CoordinateSystemFactory();
            ProjNet.CoordinateSystems.ICoordinateSystem       csSource = csf.CreateFromWkt(wktsource);
            ProjNet.CoordinateSystems.ICoordinateSystem       csTarget = csf.CreateFromWkt(wkttarget);
            ProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory ctf = new ProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory();
            ProjNet.CoordinateSystems.Transformations.ICoordinateTransformation       ct  = ctf.CreateFromCoordinateSystems(csSource, csTarget);
            SharpMapSpatialReference sr = new SharpMapSpatialReference();

            sr.CoordinateSystem = csSource;
            sr.MathTransform    = ct.MathTransform;
            return(sr);
        }
        public void Filter(GeoAPI.Geometries.Coordinate coord)
        {
            ProjNet.CoordinateSystems.ICoordinateSystem           mercator = getMercatorProjection();
            ProjNet.CoordinateSystems.IGeographicCoordinateSystem latlon   =
                (ProjNet.CoordinateSystems.IGeographicCoordinateSystem)CoordinateSystemWktReader.Parse(SRID_4236);
            ProjNet.CoordinateSystems.Transformations.ICoordinateTransformationFactory ctfac          = new CoordinateTransformationFactory();
            ProjNet.CoordinateSystems.Transformations.ICoordinateTransformation        transformation =
                ctfac.CreateFromCoordinateSystems(latlon, mercator);

            double[] newCoords = transformation.MathTransform.Transform(new double[] { coord.X, coord.Y });
            coord.X = newCoords[0];
            coord.Y = newCoords[1];
        }
        /**
         * Creates a new SRS from an OSG WKT string.
         *
         * @param wkt
         *      OGC WKT (well-known text) SRS definition
         * @param reference_frame
         *      Reference frame to apply to points in this SRS
         * @return
         *      A spatial reference. Caller is responsible for deleting
         *      the return object.
         */
        public SpatialReference createSRSfromWKT(string wkt, Mogre.Matrix4 reference_frame)
        {
            //Implementar el MatrixTransform
            //rellenar el MatrixTransform usando el reference_frame
            //SetUp coordinate transformation
            ProjNet.CoordinateSystems.CoordinateSystemFactory csf      = new ProjNet.CoordinateSystems.CoordinateSystemFactory();
            ProjNet.CoordinateSystems.ICoordinateSystem       csSource = csf.CreateFromWkt(wkt);

            SharpMapSpatialReference sr = new SharpMapSpatialReference();

            sr.CoordinateSystem = csSource;
            sr.MathTransform    = new MatrixTransform(csSource.Dimension, reference_frame);
            return(sr);
        }
Пример #7
0
    public static ProjNet.CoordinateSystems.Transformations.ICoordinateTransformation Transform2Albers(ProjNet.CoordinateSystems.ICoordinateSystem source)
    {
        if (source == null)
        {
            throw new ArgumentException("Source coordinate system is null");
        }
        if (!(source is IGeographicCoordinateSystem))
        {
            throw new ArgumentException("Source coordinate system must be geographic");
        }

        CoordinateSystemFactory cFac = new CoordinateSystemFactory();

        List <ProjectionParameter> parameters = new List <ProjectionParameter>();

        parameters.Add(new ProjectionParameter("central_meridian", -95));
        parameters.Add(new ProjectionParameter("latitude_of_origin", 50));
        parameters.Add(new ProjectionParameter("standard_parallel_1", 29.5));
        parameters.Add(new ProjectionParameter("standard_parallel_2", 45.5));
        parameters.Add(new ProjectionParameter("false_easting", 0));
        parameters.Add(new ProjectionParameter("false_northing", 0));
        IProjection projection = cFac.CreateProjection("Albers_Conic_Equal_Area", "albers", parameters);

        IProjectedCoordinateSystem coordsys = cFac.CreateProjectedCoordinateSystem("Albers_Conic_Equal_Area",
                                                                                   source as IGeographicCoordinateSystem,
                                                                                   projection, ProjNet.CoordinateSystems.LinearUnit.Metre,
                                                                                   new AxisInfo("East",
                                                                                                AxisOrientationEnum.East),
                                                                                   new AxisInfo("North",
                                                                                                AxisOrientationEnum.
                                                                                                North));

        return(new CoordinateTransformationFactory().CreateFromCoordinateSystems(source, coordsys));
    }
 /**
  * Creates a new SRS from an ESRI-style WKT/PRJ string.
  *
  * @param wkt
  *      ESRI-style WKT (well-known text) SRS definition
  * @return
  *      A spatial reference. Caller is responsible for deleting
  *      the return object.
  */
 public SpatialReference createSRSfromESRI(string wkt)
 {
     SpatialReference result = null;
     //SetUp coordinate transformation
     ProjNet.CoordinateSystems.CoordinateSystemFactory csf = new ProjNet.CoordinateSystems.CoordinateSystemFactory();
     cs = csf.CreateFromWkt(wkt);
     throw new NotImplementedException();
 }
 public SpatialReference createSRSfromWKT(string wkt, ICoordinateSystem source)
 {
     SpatialReference result = null;
     //SetUp coordinate transformation
     ProjNet.CoordinateSystems.CoordinateSystemFactory csf = new ProjNet.CoordinateSystems.CoordinateSystemFactory();
     cs = csf.CreateFromWkt(wkt);
     ProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory ctf = new ProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory();
     ctf.CreateFromCoordinateSystems(source, cs);
     ProjNet.CoordinateSystems.Transformations.ICoordinateTransformation ct = ctf.CreateFromCoordinateSystems(cs, source);
     //crear SharpMapSpatialReference usando el coordinateTranformation.
     throw new NotImplementedException();
 }