SELECT
st_astext (
st_transform ( ST_GeomFromText ( st_astext ( P.shape ), 4326 ), 3857 )) bound,
concat ( P.x1, P.x2) m1,
CAST (
REPLACE (
REPLACE (
REPLACE ( ST_AsText ( ST_centroid ( st_transform ( ST_GeomFromText ( st_astext ( P.shape ), 4326 ), 3857 ) )), ' ', ',' ),
'POINT(',
''
),
')',
''
) AS VARCHAR
) point,
( CASE P.x3 WHEN 0 THEN NULL ELSE P.x3 END ) AS m2
FROM
table P
select st_asgeojson(geom) geom,ST_AsGeoJSON (st_centroid (geom)) AS centroid from table
select st_x(st_centroid(geom)) AS x from table
select st_y(st_centroid(geom)) AS y from table