From xy table to spatial table in spatialite

A short note on how to create a spatial table from a table with latitude and longitude coordinates in your SQLite / Spatialite database. In the example below, the table I am working with is ‘labels’. Continue reading “From xy table to spatial table in spatialite”

Advertisements

Adding geometry columns to attribute table of vector map

What if you have a vector polygon layer and you want to add a column to the attribute table with the size (area) of each individual polygon? Very simple in QGIS, just go to the vector menu: vector | Geometry tools | Export/Add geometry columns, which will give you the following input screen: Continue reading “Adding geometry columns to attribute table of vector map”

Extract X and Y coordinates from a spatial table in Spatialite

A quick note on adding two columns with X and Y values in a vector layer in spatialite. Spatialite stores the information about the geometry in binary format in the ‘Geometry’ field.

You can use the Spatialite function AsText() to convert and extract these values as a Well Known Text (WKT), which is an easy to read format. If you for example have a spatial table ‘Waypoints’ with two columns ‘PKUID’ and ‘Geometry’, you can extract a column with WKT values using: Continue reading “Extract X and Y coordinates from a spatial table in Spatialite”