Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为PostGIS编写原始SQL_Sql_Spatial_Postgis_Postgresql - Fatal编程技术网

为PostGIS编写原始SQL

为PostGIS编写原始SQL,sql,spatial,postgis,postgresql,Sql,Spatial,Postgis,Postgresql,我正在尝试使用PostGIS模板将一些数据输入PostgreSQL 8.4数据库。我无法更新多边形: > UPDATE my_table SET coords = POINT(1, 1) UPDATE 0 1 > UPDATE my_table SET box = POLYGON(((1, 1), (2, 3), (3, 3), (1, 1))) ERROR: function polygon(record) does not exist > UPDATE my_tabl

我正在尝试使用PostGIS模板将一些数据输入PostgreSQL 8.4数据库。我无法
更新
多边形:

> UPDATE my_table SET coords = POINT(1, 1)
UPDATE 0 1

> UPDATE my_table SET box = POLYGON(((1, 1), (2, 3), (3, 3), (1, 1)))
ERROR:  function polygon(record) does not exist

> UPDATE my_table SET box = POLYGON((1, 1), (2, 3), (3, 3), (1, 1))
ERROR:  function polygon(record, record, record, record) does not exist

> UPDATE my_table SET box = POLYGON(1, 1, 2, 3, 3, 3, 1, 1)
ERROR:  function polygon(numeric, numeric, numeric, numeric, numeric, numeric, numeric, numeric) does not exist

> UPDATE my_table SET box = ((1, 1), (2, 3), (3, 3), (1, 1))
ERROR:  column "box" is of type polygon but expression is of type record
如何插入多边形?请注意,表中已存在数据,
NULL
字段代替空间数据。我需要
更新
,而不是
插入
,但这不会有什么区别。

试试:

UPDATE my_table SET box = '((1, 1), (2, 3), (3, 3), (1, 1))'::polygon;
据我所知,大多数几何类型通常需要引号。

试试:

UPDATE my_table SET box = '((1, 1), (2, 3), (3, 3), (1, 1))'::polygon;
据我所知,大多数几何图形类型通常都需要引号。

您应该使用在表中加载新几何图形,特别是函数:

UPDATE my_table SET box = ST_GeomFromText('POLYGON ((1 1), (2 3), (3 3), (1 1))');
几何图形是以WKT()格式定义的。

您应该使用在表中加载新几何图形,特别是函数:

UPDATE my_table SET box = ST_GeomFromText('POLYGON ((1 1), (2 3), (3 3), (1 1))');

几何体以WKT()格式定义。

您可以在专用网站@amercader中找到更多关于GIS相关问题的专家答案,谢谢!我不知道
gis
.meta.stackexchange.com…您可以在专用网站@amercader上找到更多关于gis相关问题的专家答案,谢谢!我不知道
gis
.meta.stackexchange.com。。。