graphql-engine/server/tests-py/queries/graphql_query/boolexp/postgis/setup.yaml
Shahidh K Muhammed b8700cce70
add spatial predicates for geography columns (close #1674) (#1735)
This PR adds support for PostGIS spatial predicates on geography columns. The predicates are _st_d_within and _st_intersects.
2019-03-25 17:59:52 +05:30

63 lines
1.6 KiB
YAML

type: bulk
args:
- type: run_sql
args:
sql: |
CREATE EXTENSION IF NOT EXISTS postgis;
- type: run_sql
args:
sql: |
CREATE EXTENSION IF NOT EXISTS postgis_topology;
#Create table
- type: run_sql
args:
sql: |
CREATE TABLE geom_table(
id SERIAL PRIMARY KEY,
type TEXT NOT NULL,
geom_col geometry NOT NULL
);
- type: track_table
args:
name: geom_table
schema: public
- type: run_sql
args:
sql: |
CREATE TABLE geog_table(
id SERIAL PRIMARY KEY,
name TEXT NOT NULL,
geog_col geography NOT NULL
);
- type: track_table
args:
name: geog_table
schema: public
#Insert data
- type: run_sql
args:
sql: |
INSERT INTO geom_table (type, geom_col)
VALUES
('point', ST_GeomFromText('POINT(1 2)')),
('linestring', ST_GeomFromText('LINESTRING(0 0, 0.5 1, 1 2, 1.5 3)')),
('linestring', ST_GeomFromText('LINESTRING(1 0, 0.5 0.5, 0 1)')),
('polygon', ST_GeomFromText('POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))')),
('polygon', ST_GeomFromText('POLYGON((2 0, 2 1, 3 1, 3 0, 2 0))'))
;
- type: run_sql
args:
sql: |
INSERT INTO geog_table (name, geog_col)
VALUES
('London', ST_GeographyFromText('POINT(0.1278 51.5074)') ),
('Paris', ST_GeographyFromText('POINT(2.3522 48.8566)') ),
('Moscow', ST_GeographyFromText('POINT(37.6173 55.7558)') ),
('New York', ST_GeographyFromText('POINT(-74.0060 40.7128)') ),
('Linestring', ST_GeographyFromText('SRID=4326;LINESTRING(-43.23456 72.4567,-43.23456 72.4568)')),
('Point', ST_GeographyFromText('SRID=4326;POINT(-43.23456 72.4567772)'));