所以我有地理坐标,我想创建多边形字符串,我可以将其作为几何类型插入到 Postgres 中。我正在使用 apache Nifi。
输入:
[
[
13,
52
],
[
13,
55
],
[
14,
15
]
]
预期输出:
POLYGON((13 52, 13 55, 14 15))
我尝试使用以下 JOLT 但没有运气:
[
{
"operation": "shift",
"spec": {
"*": {
"*": "[&1].[&0]"
}
}
},
{
"operation": "shift",
"spec": {
"*": {
"*": "&"
}
}
},
{
"operation": "modify-overwrite-beta",
"spec": {
"*": {
"*": "=join(' ',@(1,&))"
}
}
},
{
"operation": "modify-overwrite-beta",
"spec": {
"*": "=concat('POLYGON((',@(1,2),'))')"
}
}
]
您可以将当前的转换为:
[
{
"operation": "shift",
"spec": {
"*": {
"*": "&1"
}
}
},
{
"operation": "modify-overwrite-beta",
"spec": {
"*": "=join(' ',@(1,&))"
}
},
{
"operation": "shift",
"spec": {
"*": {
"@": "Coord"
}
}
},
{
"operation": "modify-overwrite-beta",
"spec": {
"Coord": "=join(' ,',@(1,&))",
"*": "=concat('POLYGON((',@(1,&),'))')"
}
}
]
网站上的 演示 https://jolt-demo.appspot.com/ 是: