Example #1
0
        /// <summary>
        /// Reads the field types from the OgrFeatureDefinition -> OgrFieldDefinition
        /// </summary>
        /// <param name="fdt">FeatureDatatTable</param>
        /// <param name="oLayer">OgrLayer</param>
        private void ReadColumnDefinition(FeatureDataTable fdt, OGR.Layer oLayer)
        {
            using (OGR.FeatureDefn _OgrFeatureDefn = oLayer.GetLayerDefn())
            {
                int iField;

                for (iField = 0; iField < _OgrFeatureDefn.GetFieldCount(); iField++)
                {
                    using (OGR.FieldDefn _OgrFldDef = _OgrFeatureDefn.GetFieldDefn(iField))
                    {
                        switch (_OgrFldDef.GetFieldType())
                        {
                        case 0:
                            fdt.Columns.Add(_OgrFldDef.GetName(), System.Type.GetType("System.Int32"));
                            break;

                        case 2:
                            fdt.Columns.Add(_OgrFldDef.GetName(), System.Type.GetType("System.Double"));
                            break;

                        case 4:
                            fdt.Columns.Add(_OgrFldDef.GetName(), System.Type.GetType("System.String"));
                            break;

                        case 6:
                            fdt.Columns.Add(_OgrFldDef.GetName(), System.Type.GetType("System.String"));
                            break;
                        }
                    }
                }
            }
        }
Example #2
0
 /// <summary>
 /// Loads a Ogr datasource with the specified layer
 /// </summary>
 /// <param name="Filename">datasource</param>
 /// <param name="LayerName">name of layer</param>
 public Ogr(string Filename, string LayerName)
 {
     this.Filename = Filename;
     
     OGR.ogr.RegisterAll();
     _OgrDataSource =  OGR.ogr.Open(this.Filename, 1);
     _OgrLayer = _OgrDataSource.GetLayerByName(LayerName);
 }
Example #3
0
        /// <summary>
        /// Loads a Ogr datasource with the specified layer
        /// </summary>
        /// <param name="Filename">datasource</param>
        /// <param name="LayerName">name of layer</param>
        public Ogr(string Filename, string LayerName)
        {
            this.Filename = Filename;

            OGR.ogr.RegisterAll();
            _OgrDataSource = OGR.ogr.Open(this.Filename, 1);
            _OgrLayer      = _OgrDataSource.GetLayerByName(LayerName);
        }
Example #4
0
        /// <summary>
        /// Loads a Ogr datasource with the specified layer
        /// </summary>
        /// <param name="Filename">datasource</param>
        /// <param name="LayerNum">number of layer</param>
        public Ogr(string Filename, int LayerNum)
        {
        	this.Filename = Filename;
        	
            ogr.RegisterAll();

            _OgrDataSource = OGR.ogr.Open(this.Filename, 0);
            _OgrLayer = _OgrDataSource.GetLayerByIndex(LayerNum);
        }
Example #5
0
        /// <summary>
        /// Loads a Ogr datasource with the specified layer
        /// </summary>
        /// <param name="Filename">datasource</param>
        /// <param name="LayerNum">number of layer</param>
        public Ogr(string Filename, int LayerNum)
        {
            this.Filename = Filename;

            ogr.RegisterAll();

            _OgrDataSource = OGR.ogr.Open(this.Filename, 0);
            _OgrLayer      = _OgrDataSource.GetLayerByIndex(LayerNum);
        }