Exemple #1
0
        private SharpMap.Geometries.Geometry ParseOgrGeometry(OGR.Geometry OgrGeometry)
        {
			byte[] wkbBuffer = new byte[OgrGeometry.WkbSize()];
			int i = OgrGeometry.ExportToWkb(wkbBuffer);
			return SharpMap.Converters.WellKnownBinary.GeometryFromWKB.Parse(wkbBuffer);
        }
Exemple #2
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;
		                }
	            	}
	            }
        	}
        }