[英]Passing an espg code to pyproj
我已经尝试了几种方法来创建一个字符串并在行中使用它:
inproj = Proj(init="epsg:2276",preserve_units=True)
我希望它能做到这样的事情:
epsg_in = 2276
code = '"epsg:' + epsg_in + '"'
inproj = Proj(init=code,preserve_units=True)
但我已尝试过这个和其他几个变种。 没运气。
我已经编写了一个转换数据的程序,但是想让它由GUI驱动,这样一个非计算机精明的同事就可以使用它。 为此,我必须能够将状态平面epsg代码传递给inproj。
代码不会创建格式化的字符串,导致字符串“epsg:2276”。 将此行更改为以下之一,它应该工作。
code = 'epsg:' + str(epsg_in)
要么
code = 'epsg:%s' % epsg_in
要么
code = 'epsg:{}'.format(epsg_in)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.