File tree Expand file tree Collapse file tree 4 files changed +36
-10
lines changed
examples/PostGIS - using sqlpage with geographic data Expand file tree Collapse file tree 4 files changed +36
-10
lines changed Original file line number Diff line number Diff line change 1+ SELECT ' shell' as component,
2+ ' Point edition' AS title,
3+ ' /' as link,
4+ ' book' as icon;
5+
6+ UPDATE spatial_data
7+ SET description = :Text
8+ WHERE id = $id::int AND :Text IS NOT NULL ;
9+
10+ SELECT ' form' AS component, title
11+ FROM spatial_data WHERE id = $id::int ;
12+
13+ SELECT
14+ ' Text' AS name,
15+ ' Description for the point: ' || title AS description,
16+ ' textarea' AS type,
17+ description AS value
18+ FROM spatial_data
19+ WHERE id = $id::int ;
20+
21+ SELECT ' text' as component,
22+ description as contents_md
23+ FROM spatial_data
24+ WHERE id = $id::int ;
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ SELECT 'map' as component,
1616SELECT title,
1717 ST_Y(geom) AS latitude,
1818 ST_X(geom) AS longitude,
19- ' point.sql?id=' || id as link
19+ format( ' [View]( point.sql?id=%s) [Edit](edition_form.sql?id=%s) ' , id, id) as description_md
2020FROM spatial_data;
2121
2222
Original file line number Diff line number Diff line change @@ -36,7 +36,9 @@ FROM spatial_data
3636WHERE id = $id::int ;
3737
3838SELECT ' text' as component,
39- description as contents_md
39+ description ||
40+ format(E' \n\n [Edit description](edition_form.sql?id=%s)' , id)
41+ as contents_md
4042FROM spatial_data
4143WHERE id = $id::int ;
4244
Original file line number Diff line number Diff line change 11CREATE EXTENSION IF NOT EXISTS postgis;
22
3- -- Create a spatialite-enabled database
4- CREATE TABLE spatial_data (
5- id SERIAL ,
6- title TEXT NOT NULL ,
7- geom geometry,
8- description TEXT NOT NULL ,
9- created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
3+ -- Create a table with a postgis geometry column
4+ CREATE TABLE IF NOT EXISTS spatial_data (
5+ id serial primary key NOT NULL ,
6+ title text NOT NULL ,
7+ geom geometry NULL ,
8+ description text NOT NULL ,
9+ created_at timestamp without time zone NULL DEFAULT CURRENT_TIMESTAMP
1010);
1111
1212
13- CREATE VIEW distances AS
13+ CREATE OR REPLACE VIEW distances AS
1414SELECT from_point .id AS from_id,
1515 from_point .title AS from_label,
1616 to_point .id AS to_id,
You can’t perform that action at this time.
0 commit comments