douguanyun2169 2019-06-04 14:12
浏览 61

通过shell脚本传递WKT变量

My variable is failing to pass through a shell execution, the variable is a WKT. I want to pass so I can you the variable in python. Or how can I convert a WKB to a WKT ?

I am reading a geometry from the database, the value is in a WKB format

PHP code...

$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()

Once the value has been passed to python, I want to do some calculation, get the area and do zonal statistics. Currently I am getting a null results.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 微信会员卡接入微信支付商户号收款
    • ¥15 如何获取烟草零售终端数据
    • ¥15 数学建模招标中位数问题
    • ¥15 phython路径名过长报错 不知道什么问题
    • ¥15 深度学习中模型转换该怎么实现
    • ¥15 HLs设计手写数字识别程序编译通不过
    • ¥15 Stata外部命令安装问题求帮助!
    • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
    • ¥15 TYPCE母转母,插入认方向
    • ¥15 如何用python向钉钉机器人发送可以放大的图片?