Note: these pages are no longer maintainedNever the less, much of the information is still relevant.Beware, however, that some of the command syntax is from older versions, and thus may no longer work as expected. Also: external links, from external sources, inside these pages may no longer function. |
Recipe #18 |
|
2011 January 28 |
Previous Slide | Table of Contents | Next Slide |
The problem This is like a kind of visual conclusion of the latest exercise. The problem now is:
|
CREATE TABLE railway_zones ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, railway_name TEXT NOT NULL, zone_name TEXT NOT NULL); |
SELECT AddGeometryColumn('railway_zones', 'geometry', 23032, 'MULTIPOLYGON', 'XY'); |
INSERT INTO railway_zones (id, railway_name, zone_name, geometry) SELECT NULL, name, 'A class [< 1Km]', CastToMultiPolygon( ST_Buffer(geometry, 1000.0)) FROM railways; |
INSERT INTO railway_zones (id, railway_name, zone_name, geometry) SELECT NULL, name, 'B class [< 2.5Km]', CastToMultiPolygon( ST_Difference( ST_Buffer(geometry, 2500.0), ST_Buffer(geometry, 1000.0))) FROM railways; |
INSERT INTO railway_zones (id, railway_name, zone_name, geometry) SELECT NULL, name, 'C class [< 5Km]', CastToMultiPolygon( ST_Difference( ST_Buffer(geometry, 5000.0), ST_Buffer(geometry, 2500.0))) FROM railways; |
INSERT INTO railway_zones (id, railway_name, zone_name, geometry) SELECT NULL, name, 'D class [< 10Km]', CastToMultiPolygon( ST_Difference( ST_Buffer(geometry, 10000.0), ST_Buffer(geometry, 5000.0))) FROM railways; |
INSERT INTO railway_zones (id, railway_name, zone_name, geometry) SELECT NULL, name, 'E class [< 20Km]', CastToMultiPolygon( ST_Difference( ST_Buffer(geometry, 20000.0), ST_Buffer(geometry, 10000.0))) FROM railways; |
You can now perform a simple visual check using QGIS. And that's all. |
Previous Slide | Table of Contents | Next Slide |
Author: Alessandro Furieri a.furieri@lqt.it | |
This work is licensed under the Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) license. | |
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. |