• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ISpatialReference类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ISpatialReference的典型用法代码示例。如果您正苦于以下问题:C# ISpatialReference类的具体用法?C# ISpatialReference怎么用?C# ISpatialReference使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ISpatialReference类属于命名空间,在下文中一共展示了ISpatialReference类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: QueryArgs

 public QueryArgs(string featureClass, string[] returnValues, string predicate, ISpatialReference newSpatialRefefence=null)
 {
     FeatureClass = featureClass;
     ReturnValues = returnValues;
     WhereClause = predicate;
     SpatialRefefence = newSpatialRefefence;
 }
开发者ID:agrc,项目名称:api.mapserv.utah.gov,代码行数:7,代码来源:QueryArgs.cs


示例2: CreateFeatureClass

        static IFeatureClass CreateFeatureClass(IFeatureWorkspace workspace, string name, ISpatialReference outSR)
        {
            IFieldsEdit fields = new FieldsClass();

            IFieldEdit field = new FieldClass();
            field.Type_2 = esriFieldType.esriFieldTypeOID;
            field.Name_2 = "OBJECTID";
            field.AliasName_2 = "OBJECTID";
            fields.AddField(field);

            IGeometryDefEdit geom = new GeometryDefClass();
            geom.GeometryType_2 = esriGeometryType.esriGeometryPolygon;
            geom.SpatialReference_2 = outSR;
            geom.HasM_2 = true;
            geom.HasZ_2 = false;

            field = new FieldClass();
            field.Name_2 = "SHAPE";
            field.AliasName_2 = "SHAPE";
            field.Type_2 = esriFieldType.esriFieldTypeGeometry;
            field.GeometryDef_2 = geom;
            fields.AddField(field);

            return workspace.CreateFeatureClass(name, fields, null, null, esriFeatureType.esriFTSimple, "SHAPE", "");
        }
开发者ID:NGFieldScope,项目名称:Geoprocessing,代码行数:25,代码来源:Program.cs


示例3: BuildGeometry

        private static IGeometry BuildGeometry(string s, ISpatialReference spatialReference)
        {
            var wkt = new WktText(s);

            switch (wkt.Type)
            {
                case WktType.None:
                    return null;
                case WktType.Point:
                    return BuildPoint(wkt, spatialReference);
                case WktType.LineString:
                    return BuildPolyline(wkt, spatialReference);
                case WktType.Polygon:
                    return BuildPolygon(wkt, spatialReference);
                case WktType.Triangle:
                    return BuildPolygon(wkt, spatialReference);
                case WktType.PolyhedralSurface:
                    return BuildMultiPatch(wkt, spatialReference);
                case WktType.Tin:
                    return BuildMultiPolygon(wkt, spatialReference);
                case WktType.MultiPoint:
                    return BuildMultiPoint(wkt, spatialReference);
                case WktType.MultiLineString:
                    return BuildMultiPolyline(wkt, spatialReference);
                case WktType.MultiPolygon:
                    return BuildMultiPolygon(wkt, spatialReference);
                case WktType.GeometryCollection:
                    return BuildGeometryCollection(wkt, spatialReference);
                default:
                    throw new ArgumentOutOfRangeException("s", "Unsupported geometry type: " + wkt.Type);
            }
        }
开发者ID:cumminsjp,项目名称:DnrGps_Wkt,代码行数:32,代码来源:WktGeometryExtensions.cs


示例4: Projection

 public Projection(ISpatialReference pSpatialReference, IWorkspace pWorkSpace)
 {
     IProjectedCoordinateSystem pProjectedCoordinateSys = pSpatialReference as IProjectedCoordinateSystem;
     m_pSpatialReference = pSpatialReference;
     m_pIProjection = pProjectedCoordinateSys.Projection;
     m_pWorkspace = pWorkSpace;
 }
开发者ID:hy1314200,项目名称:HyDM,代码行数:7,代码来源:Projection.cs


示例5: CreateFClassInPDB

        public static IFeatureClass CreateFClassInPDB(IWorkspace accessworkspace, string feaDSname, string FCname, esriGeometryType esriGeometryType,ISpatialReference sprf)
        {
            try
            {
                IFeatureDataset featureDataset = ((IFeatureWorkspace)accessworkspace).OpenFeatureDataset(feaDSname);
                //IGeoDataset geoDataset = featureDataset as IGeoDataset;

                IFields pFields = new FieldsClass();
                IFieldsEdit pFieldsEdit = pFields as IFieldsEdit;
                IField pField = new FieldClass();
                IFieldEdit pFieldEdit = pField as IFieldEdit;
                pFieldEdit.Name_2 = "SHAPE";
                pFieldEdit.Type_2 = esriFieldType.esriFieldTypeGeometry;

                IGeometryDef pGeometryDef = new GeometryDefClass();
                IGeometryDefEdit pGeometryDefEdit = pGeometryDef as IGeometryDefEdit;
                pGeometryDefEdit.GeometryType_2 = esriGeometryType.esriGeometryPoint;
                pFieldEdit.GeometryDef_2 = pGeometryDef;
                pFieldsEdit.AddField(pField);

                IFeatureClass fc = featureDataset.CreateFeatureClass(FCname, pFields, null, null, esriFeatureType.esriFTSimple, "Shape", "");
                return fc;
            }

            catch (Exception ee)
            {
                MessageBox.Show(ee.Message.ToString());
                return null;
            }
        }
开发者ID:chinasio,项目名称:minegis,代码行数:30,代码来源:GDBData.cs


示例6: ToGeneralGeometry

        public static IGeometry ToGeneralGeometry(this ShapeBuffer fgdbGeometry, ISpatialReference spatialReference)
        {
            var geometryType = ShapeBuffer.GetGeometryType(fgdbGeometry.shapeType);

            IGeometry geometry;
            if (geometryType.ToString() == GeometryType.Point.ToString())
            {
                geometry = ToGeneralPoint(fgdbGeometry);
            }
            else if (geometryType.ToString() == GeometryType.Polygon.ToString())
            {
                geometry = ToGeneralMultiPart(fgdbGeometry, GeometryType.Polygon);
            }
            else if (geometryType.ToString() == GeometryType.Polyline.ToString())
            {
                geometry = ToGeneralMultiPart(fgdbGeometry, GeometryType.Polyline);
            }
            else if (geometryType.ToString() == GeometryType.Multipoint.ToString())
            {
                geometry = ToGeneralMultiPoint(fgdbGeometry);
            }
            else
            {
                throw new NotSupportedException(String.Format("The geometry type {0} cannot be read", geometryType));
            }

            geometry.SpatialReference = spatialReference;
            return geometry;
        }
开发者ID:nodfreitas,项目名称:GeoDataToolkit,代码行数:29,代码来源:FgdbGeometryConverterExtensions.cs


示例7: Reproject

 public Coordinate Reproject(Coordinate coordinate, ISpatialReference @from, ISpatialReference to)
 {
     double[] xy, z;
     ToDotSpatial(coordinate, out xy, out z);
     DotSpatial.Projections.Reproject.ReprojectPoints(xy, z, GetProjectionInfo(@from), GetProjectionInfo(to), 0, 1);
     return ToGeoAPI(xy, z);
 }
开发者ID:geobabbler,项目名称:SharpMap,代码行数:7,代码来源:DotSpatialReprojector.cs


示例8: AlterRasterFieldSR

 public static IField AlterRasterFieldSR(IField pField, ISpatialReference sr)
 {
     IFieldEdit2 pEdit = pField as IFieldEdit2;
     IRasterDef pRDef = pEdit.RasterDef;
     pRDef.SpatialReference = sr;
     return pField;
 }
开发者ID:ismethr,项目名称:gas-geological-map,代码行数:7,代码来源:FieldHelper.cs


示例9: boundingBox

        /// <summary> Class to handle a boundingbox, that make sure it is within Flanderers 
        /// and return string string in the wanted format from arcgis IEnvelope </summary>
        /// <param name="arcgisBbox">arcgis IEnvelope </param>
        public boundingBox(IEnvelope arcgisBbox)
        {
            //handle SRS
            inSRS = arcgisBbox.SpatialReference;

            //Set maxbounds
            Type factoryType = Type.GetTypeFromProgID("esriGeometry.SpatialReferenceEnvironment");
            System.Object obj = Activator.CreateInstance(factoryType);
            ISpatialReferenceFactory3 spatialReferenceFactory = obj as ISpatialReferenceFactory3;

            ISpatialReference lam72 = spatialReferenceFactory.CreateSpatialReference(31370);
            IEnvelope maxBounds = geopuntHelper.makeExtend(17750, 23720, 297240, 245340, lam72); //not outside flanders
            if (inSRS.FactoryCode != lam72.FactoryCode)
            {
                maxBounds = geopuntHelper.Transform(maxBounds as IGeometry, inSRS) as IEnvelope;
            }
            if (arcgisBbox.XMin > maxBounds.XMin) Xmin = arcgisBbox.XMin;
            else Xmin = maxBounds.XMin;
            if (arcgisBbox.YMin > maxBounds.YMin) Ymin = arcgisBbox.YMin;
            else Ymin = maxBounds.YMin;
            if (arcgisBbox.XMax < maxBounds.XMax) Xmax = arcgisBbox.XMax;
            else Xmax = maxBounds.XMax;
            if (arcgisBbox.YMax < maxBounds.YMax) Ymax = arcgisBbox.YMax;
            else Ymax = maxBounds.YMax;
        }
开发者ID:geopunt,项目名称:geopunt4arcgis,代码行数:28,代码来源:boundingBox.cs


示例10: get_extent

        public static ESRI.ArcGIS.Geometry.IEnvelope get_extent(OSGeo.OGR.Envelope ogr_envelope, ISpatialReference sr)
        {
            IEnvelope env = new EnvelopeClass();
            env.PutCoords(ogr_envelope.MinX, ogr_envelope.MinY, ogr_envelope.MaxX, ogr_envelope.MaxY);
            env.SpatialReference = sr;

            return env;
        }
开发者ID:geobabbler,项目名称:arcgis-ogr,代码行数:8,代码来源:ogrplugin_utils.cs


示例11: NewRectangle

 public static IGraphic NewRectangle(double left, double top, double right, double bottom, ISpatialReference spatialRefe)
 {
     IMapPoint p1 = Runtime.geometryEngine.newMapPoint(left, top, spatialRefe);
     IMapPoint p2 = Runtime.geometryEngine.newMapPoint(right, top, spatialRefe);
     IMapPoint p3 = Runtime.geometryEngine.newMapPoint(right, bottom, spatialRefe);
     IMapPoint p4 = Runtime.geometryEngine.newMapPoint(left, bottom, spatialRefe);
     return NewQuadrilateral(p1, p2, p3, p4);
 }
开发者ID:iS3-Project,项目名称:iS3,代码行数:8,代码来源:ShapeMappingUtility.cs


示例12: AlterGeometryFieldSR

 public static IField AlterGeometryFieldSR(IField pField, ISpatialReference sr)
 {
     IFieldEdit pEdit = pField as IFieldEdit;
     IGeometryDef pGeoDef = pField.GeometryDef;
     IGeometryDefEdit pDEdit = pGeoDef as IGeometryDefEdit;
     pDEdit.SpatialReference_2 = sr;
     pEdit.GeometryDef_2 = pGeoDef;
     return pField;
 }
开发者ID:ismethr,项目名称:gas-geological-map,代码行数:9,代码来源:FieldHelper.cs


示例13: CreateFeatureClassOutput

        /// <summary>
        /// create feature class of output
        /// </summary>
        /// <param name="workspace">object workspace</param>
        /// <param name="spatialReference">spatial reference of feature class of output</param>
        /// <param name="nameFeatureClass">name of feature class</param>
        /// <returns>object feature class</returns>
        private static IFeatureClass CreateFeatureClassOutput(IWorkspace workspace, ISpatialReference spatialReference, string nameFeatureClass)
        {
            IFeatureClassDescription featureClassDescription = new FeatureClassDescriptionClass();
            IObjectClassDescription objectClassDescription = (IObjectClassDescription)featureClassDescription;

            IFeatureWorkspace featureWorkspace = (IFeatureWorkspace)workspace;

            // Create the fields collection.
            IFields fields = new FieldsClass();
            IFieldsEdit fieldsEdit = (IFieldsEdit)fields;

            IField oidField = new FieldClass();
            IFieldEdit oidFieldEdit = (IFieldEdit)oidField;
            oidFieldEdit.Name_2 = "OBJECTID";
            oidFieldEdit.Type_2 = esriFieldType.esriFieldTypeOID;
            fieldsEdit.AddField(oidField);

            // Create the Shape field.
            IField shapeField = new Field();
            IFieldEdit shapeFieldEdit = (IFieldEdit)shapeField;

            // Set up the geometry definition for the Shape field.
            IGeometryDef geometryDef = new GeometryDefClass();
            IGeometryDefEdit geometryDefEdit = (IGeometryDefEdit)geometryDef;
            geometryDefEdit.GeometryType_2 = esriGeometryType.esriGeometryPolygon;

            // By setting the grid size to 0, you're allowing ArcGIS to determine the appropriate grid sizes for the feature class.
            // If in a personal geodatabase, the grid size will be 1000. If in a file or ArcSDE geodatabase, the grid size
            // will be based on the initial loading or inserting of features.
            geometryDefEdit.HasM_2 = false;
            geometryDefEdit.HasZ_2 = false;

            geometryDefEdit.SpatialReference_2 = spatialReference;

            // Set standard field properties.
            shapeFieldEdit.Name_2 = featureClassDescription.ShapeFieldName;
            shapeFieldEdit.Type_2 = esriFieldType.esriFieldTypeGeometry;
            shapeFieldEdit.GeometryDef_2 = geometryDef;
            shapeFieldEdit.IsNullable_2 = true;
            shapeFieldEdit.Required_2 = true;
            fieldsEdit.AddField(shapeField);

            IField idField = new FieldClass();
            IFieldEdit idIsolaFieldEdit = (IFieldEdit)idField;
            idIsolaFieldEdit.Name_2 = Program.nameFieldIdOutput;
            idIsolaFieldEdit.Type_2 = esriFieldType.esriFieldTypeInteger;
            fieldsEdit.AddField(idField);

            // Use IFieldChecker to create a validated fields collection.
            IFieldChecker fieldChecker = new FieldCheckerClass();
            IEnumFieldError enumFieldError = null;
            IFields validatedFields = null;
            fieldChecker.ValidateWorkspace = workspace;
            fieldChecker.Validate(fields, out enumFieldError, out validatedFields);

            return featureWorkspace.CreateFeatureClass(nameFeatureClass, fields, objectClassDescription.InstanceCLSID, objectClassDescription.ClassExtensionCLSID, esriFeatureType.esriFTSimple, featureClassDescription.ShapeFieldName, string.Empty);
        }
开发者ID:nicogis,项目名称:Voronoi,代码行数:64,代码来源:Program.cs


示例14: OSMGPExport2OSM

        public OSMGPExport2OSM()
        {
            resourceManager = new ResourceManager("ESRI.ArcGIS.OSM.GeoProcessing.OSMGPToolsStrings", this.GetType().Assembly);

            osmGPFactory = new OSMGPFactory();
            _osmUtility = new OSMUtility();

            ISpatialReferenceFactory spatialReferenceFactory = new SpatialReferenceEnvironmentClass() as ISpatialReferenceFactory;
            m_wgs84 = spatialReferenceFactory.CreateGeographicCoordinateSystem((int)esriSRGeoCSType.esriSRGeoCS_WGS1984) as ISpatialReference;
        }
开发者ID:leijiancd,项目名称:arcgis-osm-editor,代码行数:10,代码来源:OSMGPExport2OSM.cs


示例15: ToDisplayString

        public static string ToDisplayString(ISpatialReference spatialRef)
        {
            if (spatialRef == null)
                return null;

            string strDisplay = "名称:";
            strDisplay += spatialRef.Name;

            return strDisplay;
        }
开发者ID:hy1314200,项目名称:HyDM,代码行数:10,代码来源:SpatialReferenctHelper.cs


示例16: CreatePolygonFile

        public IFeatureClass CreatePolygonFile(String strFolder, String filename, IEnvelope pEnvBorder, ISpatialReference pSR)
        {
            // Open the folder to contain the shapefile as a workspace
            IWorkspaceFactory pWF = new ESRI.ArcGIS.DataSourcesFile.ShapefileWorkspaceFactoryClass();
            IFeatureWorkspace pfws = (IFeatureWorkspace)pWF.OpenFromFile(strFolder, 0);

            //Set up a simple fields collection
            IField pField = new FieldClass();
            IFieldEdit pFieldEdit = (IFieldEdit)pField;
            IFields pFields = new FieldsClass();
            IFieldsEdit pFieldsEdit = (IFieldsEdit)pFields;

            // Make the shape field
            //it will need a geometry definition, with a spatial reference

            pFieldEdit.Name_2 = "Shape";
            pFieldEdit.Type_2 = esriFieldType.esriFieldTypeGeometry;

            IGeometryDef pGeomDef = new GeometryDef();
            IGeometryDefEdit pGeomDefEdit = (IGeometryDefEdit)pGeomDef;

            pGeomDefEdit.GeometryType_2 = esriGeometryType.esriGeometryPolygon;
            pGeomDefEdit.SpatialReference_2 = pSR;

            pFieldEdit.GeometryDef_2 = pGeomDef;
            pFieldsEdit.AddField(pField);

            // Add ID field
            IField pFieldOID = new Field();
            pFieldEdit = (IFieldEdit)pFieldOID;
            pFieldEdit.Name_2 = "OBJECTID";
            pFieldEdit.Type_2 = esriFieldType.esriFieldTypeOID;
            pFieldEdit.IsNullable_2 = false;

            pFieldsEdit.AddField(pFieldOID);

            //EulerPoleReFrmgwn eulerfrm=new EulerPoleReFrmgwn();

            if (File.Exists(strFolder + filename + ".shp") == true)
            {
                DialogResult result = MessageBox.Show("There is a shapefile have the same name in this foler, do you want to overwrite it?", "", MessageBoxButtons.OKCancel);
                if (result == DialogResult.OK)
                {
                    File.Delete(strFolder + filename);

                }
                else
                {
                    return null;
                }
            }

            IFeatureClass pFeatclass = pfws.CreateFeatureClass(filename, pFields, null, null, esriFeatureType.esriFTSimple, "Shape", "");
            return pFeatclass;
        }
开发者ID:afocusman,项目名称:PRSS_programYM,代码行数:55,代码来源:CCCreatePolygonFile.cs


示例17: Reproject

 public Envelope Reproject(Envelope envelope, ISpatialReference @from, ISpatialReference to)
 {
     var transformation = GetMathTransform(@from, to);
     
     var res = new Envelope(transformation.Transform(new Coordinate(envelope.MinX, envelope.MinY)));
     res.ExpandToInclude(transformation.Transform(new Coordinate(envelope.MinX, envelope.MaxY)));
     res.ExpandToInclude(transformation.Transform(new Coordinate(envelope.MaxX, envelope.MaxY)));
     res.ExpandToInclude(transformation.Transform(new Coordinate(envelope.MaxX, envelope.MinY)));
     
     return res;
 }
开发者ID:geobabbler,项目名称:SharpMap,代码行数:11,代码来源:ProjNetReprojector.cs


示例18: ToPrjString

        public static string ToPrjString(ISpatialReference spatialRef)
        {
            if (spatialRef == null)
                spatialRef = new UnknownCoordinateSystemClass();

            int strCount = -1;
            string prjString = null;
            (spatialRef as IESRISpatialReferenceGEN).ExportToESRISpatialReference(out prjString, out strCount);

            return prjString;
        }
开发者ID:hy1314200,项目名称:HyDM,代码行数:11,代码来源:SpatialReferenceHelper.cs


示例19: ToGpString

        /// <summary>
        /// GP的空间参考只接受字符串
        /// </summary>
        /// <param name="spatialRef"></param>
        /// <returns></returns>
        public static string ToGpString(ISpatialReference spatialRef)
        {
            if (spatialRef == null)
                return null;

            int strCount = -1;
            string gpString = null;
            (spatialRef as IESRISpatialReferenceGEN).ExportToESRISpatialReference(out gpString, out strCount);

            return gpString;
        }
开发者ID:hy1314200,项目名称:HyDM,代码行数:16,代码来源:SpatialReferenctHelper.cs


示例20: CreateFeatureDataset

        protected override IFeatureDataset CreateFeatureDataset(IWorkspace wsTarget,ISpatialReference pSpatialRef)
        {
            if (wsTarget == null)
                return null;

            ISpatialReference spatialRef = pSpatialRef;
            if (spatialRef == null)
            {
                if (!string.IsNullOrEmpty(this.ReferenceLayer))
                {
                    IWorkspace wsSource = AEAccessFactory.OpenWorkspace(this.m_DataType, this.m_Datasource);
                    IGeoDataset geoDataset = null;
                    // Shp判断使用Try Catch
                    if (this.m_DataType == enumDataType.SHP)
                    {
                        try
                        {
                            geoDataset = (wsSource as IFeatureWorkspace).OpenFeatureClass(this.ReferenceLayer) as IGeoDataset;
                        }
                        catch
                        {
                        }
                    }
                    else
                    {

                        if ((wsSource as IWorkspace2).get_NameExists(esriDatasetType.esriDTFeatureClass, this.ReferenceLayer))
                        {
                            geoDataset = (wsSource as IFeatureWorkspace).OpenFeatureClass(this.ReferenceLayer) as IGeoDataset;
                        }
                        else if ((wsSource as IWorkspace2).get_NameExists(esriDatasetType.esriDTFeatureDataset, this.ReferenceLayer))
                        {
                            geoDataset = (wsSource as IFeatureWorkspace).OpenFeatureDataset(this.ReferenceLayer) as IGeoDataset;
                        }
                    }

                    if (geoDataset != null)
                    {
                        spatialRef = geoDataset.SpatialReference;
                    }
                    else
                    {
                        SendMessage(enumMessageType.Exception, "NoReferenceDataImport调用错误:数据源中未找到指定的空间参考图层,将按未知参考创建“Dataset”");
                    }
                }
                else
                {
                    SendMessage(enumMessageType.Exception, "NoReferenceDataImport调用错误:未指定空间参考图层,将按未知参考创建“Dataset”");
                }
            }

            return base.CreateFeatureDataset(wsTarget, spatialRef);
        }
开发者ID:hy1314200,项目名称:HyDM,代码行数:53,代码来源:NoReferenceDataImport.cs



注:本文中的ISpatialReference类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ISpawnProvider类代码示例发布时间:2022-05-24
下一篇:
C# ISparqlExpression类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap