CREATE OR REPLACE VIEW ponderacion AS
SELECT row_number() OVER () AS gid,
    mv.tileid,
    mv.resourceinstanceid,
    mv.nodeid,
    mv.geom,
    ((name_tile.tiledata -> '0511276c-cdec-11ef-bee9-419cfc3bf4ec'::text) -> 'es'::text) ->> 'value'::text AS valor_resultante
   FROM geojson_geometries mv
     LEFT JOIN tiles type_tile ON mv.resourceinstanceid = type_tile.resourceinstanceid
     LEFT JOIN tiles name_tile ON mv.resourceinstanceid = name_tile.resourceinstanceid
  WHERE ((((type_tile.tiledata -> '0511276c-cdec-11ef-bee9-419cfc3bf4ec'::text) -> 'es'::text) ->> 'value'::text) = ANY (ARRAY['Valor A'::text, 'Valor B'::text, 'Valor C'::text, 'Sin valor'::text])) AND (name_tile.tiledata ->> 'c72dae37-72c7-11ee-b797-2be08bcc2bc6'::text) IS NOT NULL;