[Qgis-user] attribute query by substring or regexp
Noli Sicad
nsicad at gmail.com
Wed Jan 26 18:15:15 PST 2011
Hi Maning,
This can be easily done using Spatialite.
1. Convert your polygon shapefile in Spatialite database.
2. Dump your the attribute field (substring/text/values) into CSV from
your point shapefile using MMQGIS plugin.
3. Use the CSV with (substring/text/values) to join into your
spatialite polygon.
Use VitualText.
e.g.
~~~~~~~~~~~
CREATE VIRTUAL TABLE province USING VirtualText(Poverty2005.csv,
CP1252, 1, COMMA, DOUBLEQUOTE, ',');
PRAGMA table_info(province);
SELECT * FROM province ORDER BY Province;
CREATE TABLE real_province AS SELECT * FROM province ORDER BY Province;
PRAGMA table_info(real_province);
CREATE TABLE Province1 AS SELECT * FROM PH_Region JOIN real_province
ON (PH_Region.NAME_1 = real_province.Province);
~~~~~~~~~~
4. Dump the spatialite with selected polygons into shapefile.
I use CLI spatialite with sql script to do these things.
e.g.
spatialite mypolygon.sqlite < my_spatialite_script.sql
Noli
More information about the Qgis-user
mailing list