gpt4 book ai didi

node.js - 将点几何添加到 Postgresql

转载 作者:行者123 更新时间:2023-12-03 22:43:26 25 4
gpt4 key购买 nike

我想使用以下方法将点几何插入 PostgreSQL Db,但我收到一个错误,我不知道它来了。

const point = {type:"Point",coordinates:[-48.23456,20.12345]}
tableName.create({ geom: point }, user_id: 9 })



"error": {
"name": "SequelizeDatabaseError",
"parent": {
"name": "error",
"length": 128,
"severity": "ERROR",
"code": "22023",
"file": "gserialized_typmod.c",
"line": "164",
"routine": "postgis_valid_typmod",
"sql": "INSERT INTO \"gps_tracking\" (\"id\",\"created\",\"user_id\",\"geom\") VALUES (DEFAULT,now(),$1,ST_GeomFromGeoJSON($2)) RETURNING *;",
"parameters": [
9,
{
"type": "Point",
"coordinates": [
-48.23456,
20.12345
]
}
]
}

最佳答案

添加“crs”行解决了我的问题。谢谢

const point = {
type: 'Point',
coordinates: [39.807222, -76.984722],
crs: { type: 'name', properties: { name: 'EPSG:4326' } }
};

关于node.js - 将点几何添加到 Postgresql,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63908744/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com