我是Jolt转换的新手,正在尝试为空间数据编写规范。我无法获得预期的输出,尤其是坐标数据。任何帮助将不胜感激。
下面是我得到的输入:
{
"type": "Feature Collection",
"c rs": {
"type": "name",
"properties": {
"name": "4326"
}
},
"features": [
{
"type": "Feature",
"id": 1,
"geometry": {
"type": "Point",
"coordinates": [
-122.682207049,
45.526159497
]
},
"properties": {
"F ID": 1,
"Place Name": "Boyd Coffee",
"Place Address": "404 NW 11th Ave Portland Oregon",
"Score": 100,
"latitude": 45.526159497,
"longitude": -122.682207049
}
},
{
"type": "Feature",
"id": 2,
"geometry": {
"type": "Point",
"coordinates": [
-122.677518466,
45.525246078
]
},
"properties": {
"F ID": 2,
"Place Name": "John's Coffee Shop",
"Place Address": "301 NW Broadway St Portland Oregon",
"Score": 100,
"lat": 45.525246078,
"l on": -122.677518466
}
},
{
"type": "Feature",
"id": 3,
"geometry": {
"type": "Point",
"coordinates": [
-122.68287749,
45.526496967
]
},
"properties": {
"F ID": 3,
"Place Name": "Starbucks",
"Place Address": "1134 NW St Portland Oregon",
"Score": 100,
"latitude": 45.526496967,
"longitude": -122.68287749
}
}
]
}
预期输出是-
"features": [
{
"attributes": {
"F ID": 1,
"Place Name": "Boyd Coffee",
"Place Address": "404 NW 11th Ave Portland Oregon",
"Score": 100,
"latitude": 45.526159497,
"longitude": -122.682207049
},
"geometry": {
"x": -122.68220704900002,
"y": 45.526159496999998
}
},
{
"attributes": {
"FID": 2,
"Place Name": "John's Coffee Shop",
"Place Address": "301 NW Broadway St Portland Oregon",
"Score": 100,
"latitude": 45.525246078,
"longitude": -122.677518466
},
"geometry": {
"x": -122.677518466,
"y": 45.52524607799999
}
}
]
我已经提出了以下规格,但没有得到期望。有人可以帮忙吗?规范是:
[
{
"operation": "shift",
"spec": {
"features": {
"*": {
"properties": "features[&1].attributes",
"geometry": {
"coordinates": {
"0": "features[&].geometry.x",
"1": "features[&].geometry.y"
}
}
}
}
}
}
]
更改您的规格中的以下内容
"0": "features[&].geometry.x",
-> "0": "features[&3].geometry.x",
"1": "features[&].geometry.y",
-> "1": "features[&3].geometry.y",
[
{
"operation": "shift",
"spec": {
"features": {
"*": {
"properties": "features[&1].attributes",
"geometry": {
"coordinates": {
"0": "features[&3].geometry.x",
"1": "features[&3].geometry.y"
}
}
}
}
}
}
]