dyn*_*mic 2 php zend-framework spatial
我正在使用MySQL的zend框架.我使用Zend_Db_Table_Abstract来运行查询.我在表格中有一个空间字段:
+------------+---------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+---------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| region_id | int(5) | NO | | NULL | |
| coordinate | point | NO | MUL | NULL | |
+------------+---------+------+-----+---------+----------------+
Run Code Online (Sandbox Code Playgroud)
我正在尝试在此表中插入记录但我收到错误:
Zend_Db_Statement_Exception: SQLSTATE[22003]: Numeric value out of range: 1416 Cannot get geometry object from data you send to the GEOMETRY field .
Run Code Online (Sandbox Code Playgroud)
这样:
$this->insert(array('region_id'=>'1','coordinate'=>"GeomFromText( 'POINT(-12.461334 130.841904)'"));
Run Code Online (Sandbox Code Playgroud)
有人可以帮忙吗?
$coordinate = "GeomFromText( 'POINT(-12.461334 130.841904)')";
$this->insert(array('region_id'=>'1','coordinate'=>new Zend_Db_Expr($coordinate)));
Run Code Online (Sandbox Code Playgroud)