[英]Postgres/Postgis - How to insert geometry in postges (postgis)
I wouldike to insert this value to my database with postgres (postgis):我想用 postgres (postgis) 将此值插入到我的数据库中:
INSERT INTO test(
id, shape)
VALUES ('test', '<gml:LineString>
<gml:coordinates>
-71.16028,42.258729 -71.160837,42.259112 -71.161143,42.25932
</gml:coordinates>
</gml:LineString>');');
My table test:我的表测试:
CREATE TABLE test
(
id character varying(32) COLLATE pg_catalog."default" NOT NULL,
shape geometry,
)
WITH (
OIDS = FALSE
)
TABLESPACE pg_default;
source: https://postgis.net/docs/ST_GeomFromGML.html来源: https://postgis.net/docs/ST_GeomFromGML.html
logs ERROR:记录错误:
ERROR: parse error - invalid geometry
LINE 3: VALUES ('test', '
^
HINT: "
<g" <-- parse error at position 5 within geometry
SQL state: XX000
Character: 53
According to the documentation you linked to, you want:根据您链接到的文档,您想要:
INSERT INTO test(id, shape)
VALUES ('test',
ST_GeomFromGML('<gml:LineString>
<gml:coordinates>
-71.16028,42.258729 -71.160837,42.259112 -71.161143,42.25932
</gml:coordinates>
</gml:LineString>')
);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.