trino(368版本)拼接嵌套JSON

-- trino(368版本)拼接嵌套JSON
select 
    t2.id
    ,CAST(CAST(ROW(t2.coordinates, 'geometry') AS ROW("type" JSON, "Feature" VARCHAR)) AS JSON) as geojson
from (
    SELECT
         t1.id
        ,CAST(MAP(ARRAY['type','coordinates'], ARRAY['Polygon',t1.coordinates]) AS JSON) as coordinates
    from  ods_com_t_building_coordinates t1
    where t1.building_id = '3a08c5b2-39cf-4b19-0513-d5c086409f23'
) t2
;
posted @ 2023-07-19 17:50  chenzechao  阅读(117)  评论(0)    收藏  举报