コード例 #1
0
        public static ESRI.ArcGIS.Geometry.ISpatialReference get_spatialReference(OSGeo.OSR.SpatialReference ogrSR)
        {
            ogrSR.MorphToESRI();

            string wkt;
            ogrSR.ExportToWkt(out wkt);

            ISpatialReferenceFactory4 spatialReferenceFactory = new ESRI.ArcGIS.Geometry.SpatialReferenceEnvironmentClass();
            ISpatialReference sr;

            int bytesRead;
            spatialReferenceFactory.CreateESRISpatialReference(wkt, out sr, out bytesRead);

            return sr;
        }
コード例 #2
0
ファイル: ogrplugin_utils.cs プロジェクト: petr-k/arcgis-ogr
        public static ISpatialReference GetSpatialReference(OSGeo.OSR.SpatialReference ogrSr)
        {
            ogrSr.MorphToESRI();

            string wkt;
            ogrSr.ExportToWkt(out wkt);

            var type = Type.GetTypeFromCLSID(typeof (SpatialReferenceEnvironmentClass).GUID);
            ISpatialReferenceFactory4 spatialReferenceFactory = (ISpatialReferenceFactory4) Activator.CreateInstance(type);
            ISpatialReference sr;

            int bytesRead;
            spatialReferenceFactory.CreateESRISpatialReference(wkt, out sr, out bytesRead);

            return sr;
        }