Identify results by group and rank using SQL

I have a table with the following structure:

id          timestamp       area
717416915   18:30:53.063    25.691601
717416915   18:31:34.863    31.200506
717416915   18:32:23.665    25.690088
1994018321  18:32:45.467    37.409171
1994018321  18:33:19.612    37.409171
424164505   18:36:16.634    18.22091
424164505   18:36:36.899    18.210754
424164505   18:37:08.614    19.829266
2394018356  18:37:27.231    79.31705

What I want to do is summarize the values ​​so that I can determine the area on idordered by timestamp. For example, if I wanted to get the first value area, this would be the following:

id          timestamp       area_1
717416915   18:30:53.063    25.691601
1994018321  18:32:45.467    37.409171
424164505   18:36:16.634    18.22091
2394018356  18:37:27.231    79.31705

And if I wanted to get the second value areafor id, it would be as follows:

id          timestamp       area_2
717416915   18:31:34.863    31.200506
1994018321  18:33:19.612    37.409171
424164505   18:36:36.899    18.210754

I understand that I need to sort by time, and then determine the first value for id. I do not quite understand how to do this. What I tried to do is the following (which does not work, as I still do not understand a little how to use the function OVER).

WITH T AS (
    SELECT * OVER(PARTITION BY a.id ORDER BY a.timestamp) AS rnk
    FROM mytable AS a
) 
SELECT area as area_1
FROM T
WHERE rnk = 1
GROUP BY a.id
ORDER BY a.timestamp;

rnk=2 .., id.

+3
2

:

SELECT RANK() OVER(PARTITION BY a.id ORDER BY a.timestamp) AS rnk
+6

@dbaseman ( ):

WITH t AS (
    SELECT *
         , rank() OVER(PARTITION BY id ORDER BY ts) AS rnk
    FROM tbl
) 
SELECT id, ts, area AS area1
FROM   t
WHERE  rnk = 1
ORDER  BY id, ts;

:

SELECT DISTINCT
       id
     , nth_value(ts,   1) OVER w  AS ts
     , nth_value(area, 1) OVER w  AS area_n
FROM   tbl
WINDOW w AS (PARTITION BY id ORDER BY ts);

, . .
PostgreSQL .

+1