0

I have the following table that is populated with new data once a day.

postgres=# \d modis_c6

    Table "public.modis_c6"
   Column   |            Type             | Collation | Nullable | Default
------------+-----------------------------+-----------+----------+---------
 latitude   | numeric(6,3)                |           |          |
 longitude  | numeric(6,3)                |           |          |
 brightness | numeric(4,1)                |           |          |
 scan       | double precision            |           |          |
 track      | double precision            |           |          |
 acq_date   | date                        |           |          |
 acq_time   | time without time zone      |           |          |
 satellite  | character varying           |           |          |
 confidence | double precision            |           |          |
 version    | character varying           |           |          |
 bright_t31 | numeric(4,1)                |           |          |
 frp        | double precision            |           |          |
 geog       | geography(Point,4326)       |           |          |
 dtg        | timestamp without time zone |           |          |

Indexes:

"modis_c6_geog_idx" gist (geog)

I want to create a daily kml. I can select the correct fields with

select * from modis_c6 where acq_date = current_date - interval '1 day';

How do I process the results of the above query with the ST_AsKML function?

0

I've not tested this, but I think the following should work:

SELECT latitude,   
    longitude,  
    brightness,
    scan,       
    track,      
    acq_date,   
    acq_time,   
    satellite, 
    confidence, 
    version,    
    bright_t31, 
    frp,       
    ST_AsKML(geog) AS geog,       
    dtg
FROM modis_c6
WHERE acq_date = current_date - interval '1 day';
  • Oh... I see now. And I would need to call this query from a script that generates the rest of the KML file? – Craeft Mar 6 at 14:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.