예제 #1
0
파일: DxfFile.cs 프로젝트: Sony-NS/SharpMap
        //"PROJCS["WGS_1984_UTM_Zone_50S",
        //GEOGCS["GCS_WGS_1984",
        //DATUM["D_WGS_1984",
        //SPHEROID["WGS_1984",6378137,298.257223563]],
        //PRIMEM["Greenwich",0],
        //UNIT["Degree",0.017453292519943295]],
        //PROJECTION["Transverse_Mercator"],
        //PARAMETER["latitude_of_origin",0],
        //PARAMETER["central_meridian",117],
        //PARAMETER["scale_factor",0.9996],
        //PARAMETER["false_easting",500000],
        //PARAMETER["false_northing",10000000],UNIT["Meter",1]]";
        private GeoAPI.CoordinateSystems.IProjectedCoordinateSystem CreateUtmProjection(int utmZone)
        {
            GeoAPI.CoordinateSystems.ICoordinateSystemFactory cFac = new SharpMap.CoordinateSystems.CoordinateSystemFactory();
            //Create geographic coordinate system based on the WGS84 datum
            GeoAPI.CoordinateSystems.IEllipsoid ellipsoid = cFac.CreateFlattenedSphere("WGS_1984",
                                                                                       6378137, 298.257223563, SharpMap.CoordinateSystems.LinearUnit.Metre);
            GeoAPI.CoordinateSystems.IHorizontalDatum datum = cFac.CreateHorizontalDatum("D_WGS_1984",
                                                                                         GeoAPI.CoordinateSystems.DatumType.HD_Geocentric, ellipsoid, null);
            GeoAPI.CoordinateSystems.IGeographicCoordinateSystem gcsWGS84 = cFac.CreateGeographicCoordinateSystem("GCS_WGS_1984",
                                                                                                                  SharpMap.CoordinateSystems.AngularUnit.Degrees, datum, SharpMap.CoordinateSystems.PrimeMeridian.Greenwich,
                                                                                                                  new GeoAPI.CoordinateSystems.AxisInfo("Lon", GeoAPI.CoordinateSystems.AxisOrientationEnum.East),
                                                                                                                  new GeoAPI.CoordinateSystems.AxisInfo("Lat", GeoAPI.CoordinateSystems.AxisOrientationEnum.North));

            //Create UTM projection
            List <GeoAPI.CoordinateSystems.ProjectionParameter> parameters =
                new List <GeoAPI.CoordinateSystems.ProjectionParameter>();

            parameters.Add(new GeoAPI.CoordinateSystems.ProjectionParameter("latitude_of_origin", 0));
            parameters.Add(new GeoAPI.CoordinateSystems.ProjectionParameter("central_meridian", -183 + 6 * utmZone));
            parameters.Add(new GeoAPI.CoordinateSystems.ProjectionParameter("scale_factor", 0.9996));
            parameters.Add(new GeoAPI.CoordinateSystems.ProjectionParameter("false_easting", 500000));
            parameters.Add(new GeoAPI.CoordinateSystems.ProjectionParameter("false_northing", 10000000));
            GeoAPI.CoordinateSystems.IProjection projection = cFac.CreateProjection("Transverse Mercator", "Transverse Mercator", parameters);

            return(cFac.CreateProjectedCoordinateSystem("WGS84 UTM Zone " + utmZone.ToString() + "S",
                                                        gcsWGS84, projection, SharpMap.CoordinateSystems.LinearUnit.Metre,
                                                        new GeoAPI.CoordinateSystems.AxisInfo("East", GeoAPI.CoordinateSystems.AxisOrientationEnum.East),
                                                        new GeoAPI.CoordinateSystems.AxisInfo("North", GeoAPI.CoordinateSystems.AxisOrientationEnum.North)));
        }
예제 #2
0
        private void Initialize()
        {
            GisSharpBlog.NetTopologySuite.Geometries.PrecisionModel precisionModel =
                new GisSharpBlog.NetTopologySuite.Geometries.PrecisionModel(GeoAPI.Geometries.PrecisionModels.Floating);

            SharpMap.CoordinateSystems.CoordinateSystem wgs84 = SharpMap.CoordinateSystems.GeographicCoordinateSystem.WGS84;

            GeoAPI.CoordinateSystems.ICoordinateSystemFactory cFac = new SharpMap.CoordinateSystems.CoordinateSystemFactory();
            //Create geographic coordinate system based on the WGS84 datum
            GeoAPI.CoordinateSystems.IEllipsoid ellipsoid = cFac.CreateFlattenedSphere("WGS 84",
                                                                                       6378137, 298.257223563, SharpMap.CoordinateSystems.LinearUnit.Metre);
            GeoAPI.CoordinateSystems.IHorizontalDatum datum = cFac.CreateHorizontalDatum("WGS_1984",
                                                                                         GeoAPI.CoordinateSystems.DatumType.HD_Geocentric, ellipsoid, null);
            GeoAPI.CoordinateSystems.IGeographicCoordinateSystem gcsWGS84 = cFac.CreateGeographicCoordinateSystem("WGS 84",
                                                                                                                  SharpMap.CoordinateSystems.AngularUnit.Degrees, datum, SharpMap.CoordinateSystems.PrimeMeridian.Greenwich,
                                                                                                                  new GeoAPI.CoordinateSystems.AxisInfo("Lon", GeoAPI.CoordinateSystems.AxisOrientationEnum.East),
                                                                                                                  new GeoAPI.CoordinateSystems.AxisInfo("Lat", GeoAPI.CoordinateSystems.AxisOrientationEnum.North));

            List <GeoAPI.CoordinateSystems.ProjectionParameter> parameters =
                new List <GeoAPI.CoordinateSystems.ProjectionParameter>();

            parameters.Add(new GeoAPI.CoordinateSystems.ProjectionParameter("latitude_of_origin", 0));
            parameters.Add(new GeoAPI.CoordinateSystems.ProjectionParameter("central_meridian", 117));
            parameters.Add(new GeoAPI.CoordinateSystems.ProjectionParameter("scale_factor", 0.9996));
            parameters.Add(new GeoAPI.CoordinateSystems.ProjectionParameter("false_easting", 500000));
            parameters.Add(new GeoAPI.CoordinateSystems.ProjectionParameter("false_northing", 10000000));
            GeoAPI.CoordinateSystems.IProjection projection = cFac.CreateProjection("Transverse Mercator", "Transverse Mercator", parameters);

            GeoAPI.CoordinateSystems.IProjectedCoordinateSystem utmWGS84 = cFac.CreateProjectedCoordinateSystem("WGS84 UTM Zone 50S",
                                                                                                                gcsWGS84, projection, SharpMap.CoordinateSystems.LinearUnit.Metre,
                                                                                                                new GeoAPI.CoordinateSystems.AxisInfo("East", GeoAPI.CoordinateSystems.AxisOrientationEnum.East),
                                                                                                                new GeoAPI.CoordinateSystems.AxisInfo("North", GeoAPI.CoordinateSystems.AxisOrientationEnum.North));

            int SRID_utm50 = Convert.ToInt32(utmWGS84.AuthorityCode);    //UTM50 SRID

            SharpMap.CoordinateSystems.Transformations.CoordinateTransformationFactory ctFact =
                new SharpMap.CoordinateSystems.Transformations.CoordinateTransformationFactory();

            _Transform    = ctFact.CreateFromCoordinateSystems(utmWGS84, wgs84);
            _UTM50Factory = new GisSharpBlog.NetTopologySuite.Geometries.GeometryFactory(precisionModel, SRID_utm50);
        }
      private SharpMap.CoordinateSystems.IProjectedCoordinateSystem CreateUTMProjection(int utmZone)
      {
        SharpMap.CoordinateSystems.CoordinateSystemFactory cFac = new SharpMap.CoordinateSystems.CoordinateSystemFactory();

        SharpMap.CoordinateSystems.IEllipsoid ellipsoid = cFac.CreateFlattenedSphere("WGS 84", 6378137, 298.257223563, SharpMap.CoordinateSystems.LinearUnit.Metre);
        SharpMap.CoordinateSystems.IHorizontalDatum datum = cFac.CreateHorizontalDatum("WGS_1984", SharpMap.CoordinateSystems.DatumType.HD_Geocentric, ellipsoid, null);
        SharpMap.CoordinateSystems.IGeographicCoordinateSystem gcs = cFac.CreateGeographicCoordinateSystem("WGS 84", SharpMap.CoordinateSystems.AngularUnit.Degrees, datum, SharpMap.CoordinateSystems.PrimeMeridian.Greenwich,
          new SharpMap.CoordinateSystems.AxisInfo("Lon", SharpMap.CoordinateSystems.AxisOrientationEnum.East),
          new SharpMap.CoordinateSystems.AxisInfo("Lat", SharpMap.CoordinateSystems.AxisOrientationEnum.North));

        //Create UTM projection
        List<SharpMap.CoordinateSystems.ProjectionParameter> parameters = new List<SharpMap.CoordinateSystems.ProjectionParameter>(5);
        parameters.Add(new SharpMap.CoordinateSystems.ProjectionParameter("latitude_of_origin", 0));
        parameters.Add(new SharpMap.CoordinateSystems.ProjectionParameter("central_meridian", -183 + 6 * utmZone));
        parameters.Add(new SharpMap.CoordinateSystems.ProjectionParameter("scale_factor", 0.9996));
        parameters.Add(new SharpMap.CoordinateSystems.ProjectionParameter("false_easting", 500000));
        parameters.Add(new SharpMap.CoordinateSystems.ProjectionParameter("false_northing", 0.0));
        SharpMap.CoordinateSystems.IProjection projection = cFac.CreateProjection("Transverse Mercator", "Transverse_Mercator", parameters);
        return cFac.CreateProjectedCoordinateSystem( "WGS 84 / UTM zone " + utmZone.ToString() + "N", gcs,
          projection, SharpMap.CoordinateSystems.LinearUnit.Metre,
          new SharpMap.CoordinateSystems.AxisInfo("East", SharpMap.CoordinateSystems.AxisOrientationEnum.East),
          new SharpMap.CoordinateSystems.AxisInfo("North", SharpMap.CoordinateSystems.AxisOrientationEnum.North));
      }