如何解决在子进程中运行gdalsrsinfo
我必须在子进程中从python运行gdal命令。 我尝试的第一个命令是gdalsrsinfo。
self.proc = subprocess.Popen(['gdalsrsinfo','-e','D:\tif\dop20c_33328_5650.tif'],stdout=subprocess.PIPE,stderr=subprocess.STDOUT,shell=True)
while self.proc.poll() is None:
output = self.proc.stdout.readline().strip()
self.print_log.emit(output)
if output.startswith(b'EPSG:'):
epsg = output.rsplit(':',1)[1]
self.print_log.emit(output)
进入while循环后,该过程开始。但是输出变量始终为空。当我在shell中执行相同的命令时,我得到正确的输出。 我如何从python的shell中获得相同的输出?我还将尝试其他gdal命令并获得结果。我没有任何输出。
我正在使用python 3.7的Windows 10
顺便说一句,我的shell中命令的输出如下:
A:\>gdalsrsinfo -e D:\tif\dop20c_33328_5650.tif
EPSG:25833
PROJ.4 : +proj=utm +zone=33 +ellps=GRS80 +towgs84=0,0 +units=m +no_defs
OGC WKT2:2018 :
PROJCRS["ETRS89 / UTM zone 33N",BASEGEOGCRS["ETRS89",DATUM["European Terrestrial Reference System 1989",ELLIPSOID["GRS 1980",6378137,298.257222101,LENGTHUNIT["metre",1]]],PRIMEM["Greenwich",ANGLEUNIT["degree",0.0174532925199433]],ID["EPSG",4258]],CONVERSION["UTM zone 33N",METHOD["Transverse Mercator",9807]],PARAMETER["Latitude of natural origin",0.0174532925199433],8801]],PARAMETER["Longitude of natural origin",15,8802]],PARAMETER["Scale factor at natural origin",0.9996,SCALEUNIT["unity",1],8805]],PARAMETER["False easting",500000,8806]],PARAMETER["False northing",8807]]],CS[Cartesian,2],AXIS["(E)",east,ORDER[1],1]],AXIS["(N)",north,ORDER[2],USAGE[
SCOPE["unknown"],AREA["Europe - 12°E to 18°E and ETRS89 by country"],BBOX[46.4,12,84.01,18.01]],25833]]
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。