Sistem Referensi Spasial
Contents
[
Hide
]
Membuat Sistem Referensi Spasial
Buat Sistem Referensi Spasial dengan Pengenal 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 |
Buat Sistem Referensi Spasial dari WKT (Teks yang Diketahui dengan Baik)
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 |
Buat Sistem Referensi Spasial dengan Parameter Kustom
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)); |
Bekerja dengan Sistem Referensi Spasial
Periksa Dukungan Driver untuk Sistem Referensi Spasial
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 |
Ekspor Sistem Referensi Spasial ke WKT
Teks yang Diketahui dengan Baik (WKT) adalah bahasa markup teks untuk mewakili objek geometri vektor pada peta, sistem referensi spasial dari objek spasial dan transformasi antara sistem referensi spasial. API Aspose.GIS memungkinkan Anda membuat Sistem Referensi Spasial dari WKT seperti yang ditunjukkan dalam contoh kode berikut.
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); |
Bandingkan Sistem Referensi Spasial
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 |