我的变量无法通过Shell执行,该变量是WKT。我想通过以便可以在python中使用变量。或者如何将WKB转换为WKT?
我正在从数据库中读取几何图形,其值为WKB格式
PHP代码...
$str = pg_query($conn, "SELECT ST_AsText(geom) As geoms FROM villages WHERE setlname = '$city'") or die ("Data loading failed: ".pg_last_error());
...
...
$geom = $data['geoms'];
$output = shell_exec("/usr/bin/python Results.py $geom");
Python ...
def geomRead():
geom = sys.argv[1]
#Or how do I get the geom as wkb & convert it to wkt once it has been passed
print geom
def main():
geomRead()
if __name__ == '__main__':
main()
将值传递给python之后,我要进行一些计算,获取面积并进行区域统计。目前,我得到的结果为空。