空間参照系
Contents
[
Hide
]
空間参照系の作成
EPSG識別子(SRID)による空間参照系の作成
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // For complete examples and data files, please go to https://github.com/aspose-gis/Aspose.GIS-for-.NET | |
| var srs = SpatialReferenceSystem.CreateFromEpsg(26918); | |
| Console.WriteLine("SRS Name: {0}", srs.Name); // NAD83 / UTM zone 18N | |
| Console.WriteLine("SRS EPSG code: {0}", srs.EpsgCode); // 26918 | |
| Console.WriteLine("Datum name: {0}", srs.GeographicDatum.Name); // North_American_Datum_1983 | |
| Console.WriteLine("Datum EPSG code: {0}", srs.GeographicDatum.EpsgCode); // 6269 | |
| Console.WriteLine("Ellipsoid name: {0}", srs.GeographicDatum.Ellipsoid.Name); // GRS 1980 | |
| Console.WriteLine("Ellipsoid EPSG code: {0}", srs.GeographicDatum.EpsgCode); // 6269 | |
| Console.WriteLine("Type: {0}", srs.Type); // Projected | |
| Console.WriteLine("Dimensions count: {0}", srs.DimensionsCount); // 2 | |
| Console.WriteLine("First dimension name: {0}", srs.GetAxis(0).Name); // X | |
| Console.WriteLine("First dimension direction: {0}", srs.GetAxis(0).Direction); // East | |
| Console.WriteLine("Second dimension name: {0}", srs.GetAxis(1).Name); // Y | |
| Console.WriteLine("Second dimension direction: {0}", srs.GetAxis(1).Direction); // North | |
| Console.WriteLine("First dimension unit: {0}, {1}", srs.GetUnit(0).Name, srs.GetUnit(0).Factor); // metre, 1 | |
| Console.WriteLine("Second dimension unit: {0}, {1}", srs.GetUnit(1).Name, srs.GetUnit(1).Factor); // metre, 1 |
WKT(Well-Known text)からの空間参照系の作成
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // For complete examples and data files, please go to https://github.com/aspose-gis/Aspose.GIS-for-.NET | |
| string wkt = @" | |
| GEOGCS[""WGS 84"", | |
| DATUM[""WGS_1984"", | |
| SPHEROID[""WGS 84"",6378137,298.257223563, | |
| AUTHORITY[""EPSG"",""7030""]], | |
| AUTHORITY[""EPSG"",""6326""]], | |
| PRIMEM[""Greenwich"",0, | |
| AUTHORITY[""EPSG"",""8901""]], | |
| UNIT[""degree"",0.01745329251994328, | |
| AUTHORITY[""EPSG"",""9122""]], | |
| AUTHORITY[""EPSG"",""4326""]] | |
| "; | |
| var srs = SpatialReferenceSystem.CreateFromWkt(wkt); | |
| Console.WriteLine("SRS Name: {0}", srs.Name); // WGS 84 | |
| Console.WriteLine("SRS EPSG code: {0}", srs.EpsgCode); // 4326 | |
| Console.WriteLine("Datum name: {0}", srs.GeographicDatum.Name); // WGS_1984 | |
| Console.WriteLine("Datum EPSG code: {0}", srs.GeographicDatum.EpsgCode); // 6326 | |
| Console.WriteLine("Ellipsoid name: {0}", srs.GeographicDatum.Ellipsoid.Name); // WGS 84 | |
| Console.WriteLine("Ellipsoid EPSG code: {0}", srs.GeographicDatum.EpsgCode); // 7030 | |
| Console.WriteLine("Type: {0}", srs.Type); // Geographic | |
| Console.WriteLine("Dimensions count: {0}", srs.DimensionsCount); // 2 | |
| Console.WriteLine("First dimension name: {0}", srs.GetAxis(0).Name); // Longitude | |
| Console.WriteLine("First dimension direction: {0}", srs.GetAxis(0).Direction); // EAST | |
| Console.WriteLine("Second dimension name: {0}", srs.GetAxis(1).Name); // Latitude | |
| Console.WriteLine("Second dimension direction: {0}", srs.GetAxis(1).Direction); // NORTH | |
| Console.WriteLine("First dimension unit: {0}, {1}", srs.GetUnit(0).Name, srs.GetUnit(0).Factor); // degree, 0.01745... | |
| Console.WriteLine("Second dimension unit: {0}, {1}", srs.GetUnit(1).Name, srs.GetUnit(1).Factor); // degree, 0.01745... | |
| var geogSrs = srs.AsGeographic; | |
| Console.WriteLine("Angular unit: {0}, {1}", geogSrs.AngularUnit.Name, geogSrs.AngularUnit.Factor); // degree, 0.01745... | |
| Console.WriteLine("Prime meridian: {0}, {1}", geogSrs.PrimeMeridian.Name, geogSrs.PrimeMeridian.Longitude); // Greenwich, 0 |
カスタムパラメータによる空間参照系の作成
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // For complete examples and data files, please go to https://github.com/aspose-gis/Aspose.GIS-for-.NET | |
| var parameters = new ProjectedSpatialReferenceSystemParameters | |
| { | |
| Name = "WGS 84 / World Mercator", | |
| Base = SpatialReferenceSystem.Wgs84, | |
| ProjectionMethodName = "Mercator_1SP", | |
| LinearUnit = Unit.Meter, | |
| XAxis = new Axis("Easting", AxisDirection.East), | |
| YAxis = new Axis("Northing", AxisDirection.North), | |
| AxisesOrder = ProjectedAxisesOrder.XY, | |
| }; | |
| parameters.AddProjectionParameter("central_meridian", 0); | |
| parameters.AddProjectionParameter("scale_factor", 1); | |
| parameters.AddProjectionParameter("false_easting", 100); | |
| parameters.AddProjectionParameter("false_northing", 100); | |
| var projectedSrs = SpatialReferenceSystem.CreateProjected(parameters, Identifier.Epsg(3395)); |
空間参照系での作業
空間参照系のサポートの確認
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // For complete examples and data files, please go to https://github.com/aspose-gis/Aspose.GIS-for-.NET | |
| Drivers.Shapefile.SupportsSpatialReferenceSystem(SpatialReferenceSystem.Wgs72); // true | |
| Drivers.GeoJson.SupportsSpatialReferenceSystem(SpatialReferenceSystem.Wgs84); // true | |
| Drivers.GeoJson.SupportsSpatialReferenceSystem(SpatialReferenceSystem.Wgs72); // false |
空間参照系をWKTにエクスポート
Well-known text(WKT)は、地図上のベクトルジオメトリオブジェクト、空間オブジェクトの空間参照系、および空間参照系の間の変換を表すためのテキストマークアップ言語です。Aspose.GIS APIを使用すると、次のサンプルコードに示すように、WKTから空間参照系を作成できます。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // For complete examples and data files, please go to https://github.com/aspose-gis/Aspose.GIS-for-.NET | |
| var parameters = new ProjectedSpatialReferenceSystemParameters | |
| { | |
| Name = "WGS 84 / World Mercator", | |
| Base = SpatialReferenceSystem.Wgs84, | |
| ProjectionMethodName = "Mercator_1SP", | |
| LinearUnit = Unit.Meter, | |
| XAxis = new Axis("Easting", AxisDirection.East), | |
| YAxis = new Axis("Northing", AxisDirection.North), | |
| AxisesOrder = ProjectedAxisesOrder.XY, | |
| }; | |
| parameters.AddProjectionParameter("central_meridian", 0); | |
| parameters.AddProjectionParameter("scale_factor", 1); | |
| parameters.AddProjectionParameter("false_easting", 0); | |
| parameters.AddProjectionParameter("false_northing", 0); | |
| var projectedSrs = SpatialReferenceSystem.CreateProjected(parameters, Identifier.Epsg(3395)); | |
| string wkt = projectedSrs.ExportToWkt(); | |
| Console.WriteLine(wkt); |
空間参照系の比較
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // For complete examples and data files, please go to https://github.com/aspose-gis/Aspose.GIS-for-.NET | |
| string wkt = @" | |
| GEOGCS[""WGS 84"", | |
| DATUM[""WGS_1984"", | |
| SPHEROID[""WGS 84"",6378137,298.257223563, | |
| AUTHORITY[""EPSG"",""7030""]], | |
| AUTHORITY[""EPSG"",""6326""]], | |
| PRIMEM[""Greenwich"",0, | |
| AUTHORITY[""EPSG"",""8901""]], | |
| UNIT[""degree"",0.01745329251994328, | |
| AUTHORITY[""EPSG"",""9122""]], | |
| AUTHORITY[""EPSG"",""4326""]] | |
| "; | |
| var srs = SpatialReferenceSystem.CreateFromWkt(wkt); | |
| srs.IsEquivalent(SpatialReferenceSystem.Wgs84); // true |