【发布时间】:2018-10-30 13:43:35
【问题描述】:
type sols3json.json | jq-win64.exe "[.[] | { "type": "FeatureCollection","features":[{ type: "Feature", "geometry": {"type": "LineString","coordinates": [ [.OpStartLongitude, .OpStartLatitude| tonumber], [ .OpEndLongitude, .OpEndLatitude | tonumber] ] }, properties: {name: .SolName}}]}" > sols3.geojson
我得到 jq:error: syntax error, unexpected $end(Windows cmd shell 引用问题?) 我究竟做错了什么? 输出应该是这样的:
{
"type": "FeatureCollection",
"features":
[
{
"properties": {
"ccaa": "CATALUNYA",
"prov": "LLEIDA",
"dir": "N-IIA/SOSES/TORRES DE SEGRE/ALCARRàS",
"roadnumber": "A-2",
"tmc": "E17+02413"
},
"geometry": {
"coordinates": [
[
0.4714937,
41.5420936
],
[
0.4891472,
41.5497014
]
],
"type": "LineString"
},
"type": "Feature"
}
]
}
【问题讨论】:
-
过滤器末尾缺少右方括号
] -
为了检查您的过滤器是否有用,请添加相关文件
sols3json.json的内容。 -
如果我添加它,我会得到 jq: error: FeatureCollection/0 is not defined at
, line 1: -
文件包含以下格式的数据:{ "TMC": "E17+02412", "ROADNUMBER": "A-2", "DIR": "E-90/AP-2/ BARCELONA-ZARAGOZA (SOSES)”、“PROV”:“LLEIDA”、“CCAA”:“CATALUNYA”、“StartLatitude”:“41.5368273”、“StartLongitude”:“0.4387071”、“EndLatitude”:“41.5388396”、“EndLongitude” ": "0.4638462" } 但属性名称不同
-
您应该使用您想要的确切格式更新您的问题。链接外部页面不是提出好问题的正确方法