使用数据流+;梁&x2B;python
如何使用Dataflow+Beam+Python从Google云存储中读取Shapefile。使用数据流+;梁&x2B;python,python,google-cloud-storage,google-cloud-dataflow,apache-beam,shapefile,Python,Google Cloud Storage,Google Cloud Dataflow,Apache Beam,Shapefile,如何使用Dataflow+Beam+Python从Google云存储中读取Shapefile。 我只找到了beam.io.ReadFromText,但python shapefile reader需要像object这样的文件:shp.reader(shp=shp\u文件,dbf=dbf\u文件)或一个shapefile。 我正在使用Python 2.7。这是一种方法: prj_file=beam.io.gcp.gcsio.gcsio().open( filenamePRJ, mode='r',
我只找到了
beam.io.ReadFromText
,但python shapefile reader需要像object这样的文件:shp.reader(shp=shp\u文件,dbf=dbf\u文件)
或一个shapefile。我正在使用Python 2.7。这是一种方法:
prj_file=beam.io.gcp.gcsio.gcsio().open(
filenamePRJ,
mode='r',
读取缓冲区大小=1677721600,
mime_type='application/octet stream'
)
shp_file=beam.io.gcp.gcsio.gcsio().open(
文件名HP,
mode='r',
读取缓冲区大小=1677721600,
mime_type='application/octet stream'
)
dbf_file=beam.io.gcp.gcsio.gcsio().open(
filenameDBF,
mode='r',
读取缓冲区大小=1677721600,
mime_type='application/octet stream'
)
sf=shp.Reader(shp=shp\u文件,dbf=dbf\u文件)
euref=osr.SpatialReference()
euref.ImportFromWkt(str(prj_file.read()))
wgs84=osr.SpatialReference()
wgs84.进口RomePSG(4326)
转换=osr.坐标转换(euref,wgs84)
这是一个python包,其中包括用于读取形状文件的自定义梁I/O连接器: