Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Now open the SQL window () and start the definition of your table by using the following code:

Code Block
languagesql
titleCreate table SQL statement
create table locations (

...


station_id integer,

...


latitude double precision,

...


longitude double precision,

...


station_code text)

Execute the query using the green button ().

Load the data using the import tool (select the table locations, right mouse button, choose import). Select the file using the browse button and select csv.

...

Previous step result in a table without geometry. So now add a column called geom with datatype geometry (via the Query window and the green execute button)

Code Block
languagesql
titleAdd column goemetry
alter table locations add column geom geometry(POINT,4326)

We know that the data is in WGS84 (which has the specific code 4326, see spatialreference.org which gives the full description of the WGS84 projection), so a point geometry with spatial reference id (SRID) 4326 is created. This step results in the creation of a column called geom.

Update the table with the following query

Code Block
languagesql
titleUpdate rows statement
update locations set geom = st_setsrid(st_point(longitude,latitude),4326)

Pressing the green execute button updates the column geom with a geometry based on the columns longitude and latitude.

...