I have imported a CSV containing points with coordinates specified in columns named Latitude and Longitude. How do tell spatialite that these columns are the coordinates of of my points?
1 Answer
Add first a geometry column into your table with SQL
SELECT AddGeometryColumn('your_table','geometry',4326,'POINT',2);
Then populate the new geometry column by constructing point geometries from your Latitude and Longitude fields with SQL
UPDATE your_table SET geometry = GeomFromText('POINT('||"Longitude"||' '||"Latitude"||')',4326);
-
-
1It is the same in PostGIS (which do have also other alternatives which are easier to write) bostongis.com/postgis_pointfromtext_linefromtext_etc.snippet and the same idea works also with Oracle Spatial so keep it in your mind. Jul 4, 2014 at 17:09
-
adding a column with a select statement is a bit counter-intuitive, that's all.– fccoelhoJul 5, 2014 at 18:39