Given my dummy data:
$ cat qingfujie_roads.geojson
{
"type": "FeatureCollection",
"name": "qingfujie_roads",
"features": [
{ "type": "Feature", "properties": { "land_id": "123", "xcenter": 120.870582715925, "ycenter": 24.183864790114}}
]
}
Output in one go using OGR Spatialite SQL functions ST_Point
(create point geometry from x,y) and ST_AsText
(create the WKT from geometry):
$ ogr2ogr -f CSV /vsistdout/ qingfujie_roads.geojson -dialect SQLite \
-sql 'SELECT land_id AS name, ST_AsText(ST_Point(xcenter, ycenter)) as WKT FROM "qingfujie_roads"'
name,WKT
"123",POINT(120.870583 24.183865)
Or
$ ogrinfo qingfujie_roads.geojson -dialect SQLite \
-sql 'SELECT land_id AS name, ST_AsText(ST_Point(xcenter, ycenter)) as WKT FROM "qingfujie_roads"'
INFO: Open of `qingfujie_roads.geojson'
using driver `GeoJSON' successful.
Layer name: SELECT
Geometry: None
Feature Count: 1
Layer SRS WKT:
(unknown)
name: String (0.0)
WKT: String (0.0)
OGRFeature(SELECT):0
name (String) = 123
WKT (String) = POINT(120.870583 24.183865)
Documentation on OGR SQL if built with spatialite support: