Last active
February 24, 2021 12:46
-
-
Save uprel/11ea3032bf97d8c38c044d09a92cf3a3 to your computer and use it in GitHub Desktop.
Postgis example to enable WSGI search in EQWC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE VIEW public.search_pop_places AS | |
SELECT pop_places.name AS searchstring, | |
(pop_places.type::text || ' '::text) || pop_places.name::text AS displaytext, | |
'01_pop_places'::text AS search_category, | |
pop_places.geom AS the_geom, | |
'pop_places'::text AS showlayer | |
FROM pop_places; | |
CREATE OR REPLACE VIEW public.search_airports AS | |
SELECT (airports.name || ' ' || airports.iata) AS searchstring, | |
(airports.name || ' (' || airports.iata ||')') AS displaytext, | |
'02_airports'::text AS search_category, | |
airports.geom AS the_geom, | |
'airports'::text AS showlayer | |
FROM airports; | |
CREATE OR REPLACE VIEW public.search_admin AS | |
SELECT admin.name AS searchstring, | |
(admin.admintype::text || ' '::text) || admin.name::text AS displaytext, | |
'03_municipality'::text AS search_category, | |
admin.geom AS the_geom, | |
'municipality'::text AS showlayer | |
FROM admin; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE public.pop_places | |
( | |
gid integer NOT NULL DEFAULT nextval('pop_places_gid_seq'::regclass), | |
name character varying(254), | |
iso_cc character varying(4), | |
type character varying(30), | |
rank smallint, | |
population character varying(30), | |
geom geometry(Point), | |
CONSTRAINT pop_places_pkey PRIMARY KEY (gid) | |
) | |
CREATE TABLE public.airports | |
( | |
gid integer NOT NULL DEFAULT nextval('airports_gid_seq'::regclass), | |
iso_cc character varying(4), | |
name character varying(100), | |
icao character varying(5), | |
iata character varying(5), | |
geom geometry(Point,4326), | |
CONSTRAINT airports_pkey PRIMARY KEY (gid) | |
) | |
CREATE TABLE public.admin | |
( | |
gid integer NOT NULL DEFAULT nextval('admin_gid_seq'::regclass), | |
name character varying(44), | |
country character varying(50), | |
iso_code character varying(6), | |
iso_cc character varying(2), | |
iso_sub character varying(5), | |
admintype character varying(50), | |
disputed integer, | |
notes character varying(254), | |
autonomous integer, | |
countryaff character varying(100), | |
continent character varying(13), | |
land_type character varying(20), | |
land_rank integer, | |
geom geometry(MultiPolygon,4326), | |
CONSTRAINT admin_pkey PRIMARY KEY (gid) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment