[gdal-dev] DBF file associated with Raster

Ivan Lucena ivan.lucena at princeton-ma.us
Thu Sep 6 18:52:47 PDT 2012


Hi Even,

On 9/6/12 12:05 PM, Even Rouault wrote:
> Selon Ivan Lucena <ivan.lucena at princeton-ma.us>:
>
>> Hi Alisson,
>>
>> How did that dbf was create?
>>
>> Can you run ogrinfo and report it back to us?
>>
>> gdalinfo file-name.dbf
> Ivan certainly meant : ogrinfo file-name.dbf
Oops.

What as I thinking? :|

That is right Allison. I meant to say ogrinfo.

>> Is there a .shp file associated with that dbf?
> To my knowledge, there's no GDAL driver that directly manages attributes that
> would be associated and contained in a DBF file. The correlation between the
> raster and attribute information must be done by the user and/or other tools.

I vaguely remember that some GIS software used to create a raster 
attribute table in DBF when the image was thematic or if it has some 
histogram associated. Was it ArcView by any chance? Since Allison is in 
Brazil, another possibility is that the raster is associated with DBF 
through SPRING or TerraLib. If that is the case GDAL is not going to 
read it. But that is also old school. I don't think they use DBF it 
anymore. There is just one thing that keep DBF alive and that is the 
Shapefiles.

Anyway, there is just a few drivers in GDAL that support Raster 
Attribute Table:

$ grep -l GDALRasterAttributeTable frmts/*/*.cpp
frmts/aigrid/aigdataset.cpp
frmts/georaster/georaster_dataset.cpp
frmts/hfa/hfadataset.cpp
frmts/idrisi/IdrisiDataset.cpp
frmts/raw/idadataset.cpp

But they store the RAT on their own data storage. Not on DBF files. I 
wrote two of those drivers and I think I could identify a RAT if you 
send the ogrinfo report.

So if you got a .TIF, for example, with a .DBF associated to it (same 
base name) hopefully you could convert the data to one of those formats 
then GDAL will be able to read it.

Another possibility is that the GDAL PAMDataset could store RAT in 
auxiliary xml files, so you can keep the raster data as it is. The 
problem is that you would need to convert the content of your DBF to the 
PAMDataset schema.

Does it makes sense Even?

Regards,

Ivan

>
>> Regards,
>>
>> Ivan
>>
>>>   -------Original Message-------
>>>   From: Alisson Barbosa <alisson.uece at gmail.com>
>>>   To: gdal-dev at lists.osgeo.org
>>>   Subject: [gdal-dev] DBF file associated with Raster
>>>   Sent: Sep 06 '12 08:59
>>>
>>>   Hi,
>>>
>>>   I want to know how to read the attributes of a dbf file associated with a
>>>   raster using GDAL.
>>>
>>>   Regards,
>>>   --
>>>   Alisson Barbosa
>>>   Systems Analyst - FUNCEME - Brazil
>>>
>>>
>>>   --------------------
>>>   _______________________________________________
>>>   gdal-dev mailing list
>>>   [LINK: compose.php?to=gdal-dev at lists.osgeo.org] gdal-dev at lists.osgeo.org
>>>   [LINK: http://lists.osgeo.org/mailman/listinfo/gdal-dev]
>>>   http://lists.osgeo.org/mailman/listinfo/gdal-dev
>> _______________________________________________
>> gdal-dev mailing list
>> gdal-dev at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>>
>
>



More information about the gdal-dev mailing list