使用Python读入数据库文件(DBF),然后打印shapefile

2024-10-04 01:25:16 发布

您现在位置:Python中文网/ 问答频道 /正文

我的目标是使用Python从CropScape读入DBF,并绘制DBF以创建一个图,如示例所示。我需要帮助读取和绘制DBF

数据:我从https://nassgeodata.gmu.edu/CropScape/下载了CropScape-Crodpland DBF。我将我感兴趣的领域定义为爱荷华州

Define Area of Interest

然后我下载2020cornsoybean年的定义的感兴趣区域数据,以及投影Degrees Lat/Lon, WGS84 Datum

Download Defined Area of Interest Data

Flight Path overlaid on Iowa CropScape DBF

到目前为止,我所拥有的:

filename = 'CDL_2020_clip_20210826173123_1609691609.tif.vat.dbf'
dbf = gpd.read_file(filename)

可能有用的其他信息包括:

dbf.head() = 
VALUE  RED  GREEN   BLUE  CLASS_NAME  OPACITY  geometry
0  0  0.0  0.000  0.000  Background  0.0  None
1  1  1.0  0.827  0.000  Corn  1.0  None
2  2  1.0  0.149  0.149  Cotton  1.0  None
3  3  0.0  0.659  0.894  Rice  1.0  None
4  4  1.0  0.620  0.043  Sorghum  1.0  None

len(dbf) = 256

Tags: 数据httpsnone示例目标定义绘制filename
1条回答
网友
1楼 · 发布于 2024-10-04 01:25:16

ArcGIS_coloro_table_readme.docx内容

To view the image attribute file of the downloaded CDL data in GeoTIFF format in ArgGIS software, the user has to load a .tif.vat.dbf created by ArcGIS. The .tif.vat.dbf file has to have the same file name as the CDL data file. There are two .tif.vat.dbf files included in the downloaded package. The default .tif.vat.dbf file, which has the same file name as the CDL file, is compatible with the ArcGIS. 10.3.1 as shown in the following example: CDL_2019_clip_20200203101819_718535908.tif CDL_2019_clip_20200203101819_718535908.tif.vat.dbf

Please notice that all three file extension tags .tif.vat.dbf are required.

The ArcGIS. 10.3.1 (including earlier version) and ArcGIS 10.7.0 use different scales for RGB values. The ArcGIS 10.3.1 outputs RGB values ranging from 0 – 1 (same as the Erdas Imagine values), while ArcGIS 10.7.0 has RGB values ranging from 0 – 255.

All CDLs from previous years (up to 2018) have .vat.dbf files with RGB values ranging from 0 – 1. Therefore, they are compatible with the .tif.vat.dbf file of the ArcGIS. 10.3.1 version. Starting from 2019 CDLs, the .tif.vat.dbf file of ArcGIS 10.7.0 are included in the downloading package to make it compatible with ArcGIS 10.7.0. Users have to rename the included file “ArcGIS10.7.0_2019_30m_cdls.tif.vat.dbf” to the same name as the CDL file’s like the following: CDL_2019_clip_20200203101819_718535908.tif.vat.dbf If you want to view the image attribute in the ArcGIS 10.7.0. The renamed .tif.vat.dbf file has to be loaded into ArcGIS 10.7.0. along with the CDL file.

NASS maintains an extensive Frequently Asked Questions (FAQs) webpage, including how to properly attribute the CDL in ESRI ArcGIS and Erdas Imagine, at the following webpage: https://www.nass.usda.gov/Research_and_Science/Cropland/sarsfaqs2.php#Section2_1.0.

相关问题 更多 >