当前位置: 首页>>代码示例>>C#>>正文


C# ISpatialReference类代码示例

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


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


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