Revision 13904
Added by Aaron Marcuse-Kubitza over 10 years ago
trunk/schemas/util.sql | ||
---|---|---|
2169 | 2169 |
|
2170 | 2170 |
|
2171 | 2171 |
-- |
2172 |
-- Name: in_new_world(geocoord); Type: FUNCTION; Schema: util; Owner: - |
|
2173 |
-- |
|
2174 |
|
|
2175 |
CREATE FUNCTION in_new_world(point geocoord) RETURNS boolean |
|
2176 |
LANGUAGE sql IMMUTABLE |
|
2177 |
AS $_$ |
|
2178 |
/* use function rather than operator+search_path to allow inlining, which |
|
2179 |
enables util.new_world() to only be evaluated once */ |
|
2180 |
SELECT util.contained_within_approx($1, util.new_world()) |
|
2181 |
$_$; |
|
2182 |
|
|
2183 |
|
|
2184 |
-- |
|
2185 |
-- Name: FUNCTION in_new_world(point geocoord); Type: COMMENT; Schema: util; Owner: - |
|
2186 |
-- |
|
2187 |
|
|
2188 |
COMMENT ON FUNCTION in_new_world(point geocoord) IS ' |
|
2189 |
**WARNING**: this includes false positives above and below the New World |
|
2190 |
bounding box, as described in util.bounding_box() |
|
2191 |
'; |
|
2192 |
|
|
2193 |
|
|
2194 |
-- |
|
2172 | 2195 |
-- Name: in_reverse(anyarray); Type: FUNCTION; Schema: util; Owner: - |
2173 | 2196 |
-- |
2174 | 2197 |
|
... | ... | |
2380 | 2403 |
|
2381 | 2404 |
|
2382 | 2405 |
-- |
2383 |
-- Name: lat_long_in_new_world(geocoord); Type: FUNCTION; Schema: util; Owner: - |
|
2384 |
-- |
|
2385 |
|
|
2386 |
CREATE FUNCTION lat_long_in_new_world(point geocoord) RETURNS boolean |
|
2387 |
LANGUAGE sql IMMUTABLE |
|
2388 |
AS $_$ |
|
2389 |
/* use function rather than operator+search_path to allow inlining, which |
|
2390 |
enables util.new_world() to only be evaluated once */ |
|
2391 |
SELECT util.contained_within_approx($1, util.new_world()) |
|
2392 |
$_$; |
|
2393 |
|
|
2394 |
|
|
2395 |
-- |
|
2396 |
-- Name: FUNCTION lat_long_in_new_world(point geocoord); Type: COMMENT; Schema: util; Owner: - |
|
2397 |
-- |
|
2398 |
|
|
2399 |
COMMENT ON FUNCTION lat_long_in_new_world(point geocoord) IS ' |
|
2400 |
**WARNING**: this includes false positives above and below the New World |
|
2401 |
bounding box, as described in util.bounding_box() |
|
2402 |
'; |
|
2403 |
|
|
2404 |
|
|
2405 |
-- |
|
2406 | 2406 |
-- Name: limit2row_num(integer, integer, integer); Type: FUNCTION; Schema: util; Owner: - |
2407 | 2407 |
-- |
2408 | 2408 |
|
trunk/schemas/vegbien.my.sql | ||
---|---|---|
1360 | 1360 |
|
1361 | 1361 |
|
1362 | 1362 |
-- |
1363 |
-- Name: lat_long_in_new_world(util.geocoord); Type: FUNCTION; Schema: public; Owner: -
|
|
1363 |
-- Name: in_new_world(util.geocoord); Type: FUNCTION; Schema: public; Owner: - |
|
1364 | 1364 |
-- |
1365 | 1365 |
|
1366 | 1366 |
|
1367 | 1367 |
|
1368 | 1368 |
|
1369 | 1369 |
-- |
1370 |
-- Name: FUNCTION lat_long_in_new_world(point util.geocoord); Type: COMMENT; Schema: public; Owner: -
|
|
1370 |
-- Name: FUNCTION in_new_world(point util.geocoord); Type: COMMENT; Schema: public; Owner: - |
|
1371 | 1371 |
-- |
1372 | 1372 |
|
1373 | 1373 |
|
trunk/schemas/public_.sql | ||
---|---|---|
2182 | 2182 |
|
2183 | 2183 |
|
2184 | 2184 |
-- |
2185 |
-- Name: lat_long_in_new_world(util.geocoord); Type: FUNCTION; Schema: public; Owner: -
|
|
2185 |
-- Name: in_new_world(util.geocoord); Type: FUNCTION; Schema: public; Owner: - |
|
2186 | 2186 |
-- |
2187 | 2187 |
|
2188 |
CREATE FUNCTION lat_long_in_new_world(point util.geocoord) RETURNS boolean
|
|
2188 |
CREATE FUNCTION in_new_world(point util.geocoord) RETURNS boolean |
|
2189 | 2189 |
LANGUAGE sql IMMUTABLE |
2190 | 2190 |
AS $_$ |
2191 |
SELECT util.lat_long_in_new_world($1)
|
|
2191 |
SELECT util.in_new_world($1) |
|
2192 | 2192 |
$_$; |
2193 | 2193 |
|
2194 | 2194 |
|
2195 | 2195 |
-- |
2196 |
-- Name: FUNCTION lat_long_in_new_world(point util.geocoord); Type: COMMENT; Schema: public; Owner: -
|
|
2196 |
-- Name: FUNCTION in_new_world(point util.geocoord); Type: COMMENT; Schema: public; Owner: - |
|
2197 | 2197 |
-- |
2198 | 2198 |
|
2199 |
COMMENT ON FUNCTION lat_long_in_new_world(point util.geocoord) IS '
|
|
2199 |
COMMENT ON FUNCTION in_new_world(point util.geocoord) IS ' |
|
2200 | 2200 |
wrapper that prevents views from getting dropped when the util schema is reinstalled |
2201 | 2201 |
'; |
2202 | 2202 |
|
... | ... | |
6047 | 6047 |
analytical_stem.scrubbed_species_binomial AS "speciesBinomial", |
6048 | 6048 |
analytical_stem.scrubbed_taxon_name_with_author AS "scientificName" |
6049 | 6049 |
FROM analytical_stem |
6050 |
WHERE ((((((COALESCE((analytical_stem.geovalid_bien)::boolean, true) AND (COALESCE((analytical_stem."isNewWorld_bien")::boolean, false) OR lat_long_in_new_world(ROW(analytical_stem."decimalLatitude__@DwC__@vegpath.org", analytical_stem."decimalLongitude__@DwC__@vegpath.org")))) AND (NOT COALESCE((analytical_stem.cultivated_bien)::boolean, false))) AND (analytical_stem.scrubbed_family IS NOT NULL)) AND (analytical_stem."decimalLatitude__@DwC__@vegpath.org" IS NOT NULL)) AND (analytical_stem."decimalLongitude__@DwC__@vegpath.org" IS NOT NULL)) AND COALESCE((analytical_stem."coordinateUncertaintyInMeters__@DwC__@vegpath.org" <= _km_to_m((10)::double precision)), true));
|
|
6050 |
WHERE ((((((COALESCE((analytical_stem.geovalid_bien)::boolean, true) AND (COALESCE((analytical_stem."isNewWorld_bien")::boolean, false) OR in_new_world(ROW(analytical_stem."decimalLatitude__@DwC__@vegpath.org", analytical_stem."decimalLongitude__@DwC__@vegpath.org")))) AND (NOT COALESCE((analytical_stem.cultivated_bien)::boolean, false))) AND (analytical_stem.scrubbed_family IS NOT NULL)) AND (analytical_stem."decimalLatitude__@DwC__@vegpath.org" IS NOT NULL)) AND (analytical_stem."decimalLongitude__@DwC__@vegpath.org" IS NOT NULL)) AND COALESCE((analytical_stem."coordinateUncertaintyInMeters__@DwC__@vegpath.org" <= _km_to_m((10)::double precision)), true)); |
|
6051 | 6051 |
|
6052 | 6052 |
|
6053 | 6053 |
-- |
trunk/schemas/vegbien.sql | ||
---|---|---|
2182 | 2182 |
|
2183 | 2183 |
|
2184 | 2184 |
-- |
2185 |
-- Name: lat_long_in_new_world(util.geocoord); Type: FUNCTION; Schema: public; Owner: -
|
|
2185 |
-- Name: in_new_world(util.geocoord); Type: FUNCTION; Schema: public; Owner: - |
|
2186 | 2186 |
-- |
2187 | 2187 |
|
2188 |
CREATE FUNCTION lat_long_in_new_world(point util.geocoord) RETURNS boolean
|
|
2188 |
CREATE FUNCTION in_new_world(point util.geocoord) RETURNS boolean |
|
2189 | 2189 |
LANGUAGE sql IMMUTABLE |
2190 | 2190 |
AS $_$ |
2191 |
SELECT util.lat_long_in_new_world($1)
|
|
2191 |
SELECT util.in_new_world($1) |
|
2192 | 2192 |
$_$; |
2193 | 2193 |
|
2194 | 2194 |
|
2195 | 2195 |
-- |
2196 |
-- Name: FUNCTION lat_long_in_new_world(point util.geocoord); Type: COMMENT; Schema: public; Owner: -
|
|
2196 |
-- Name: FUNCTION in_new_world(point util.geocoord); Type: COMMENT; Schema: public; Owner: - |
|
2197 | 2197 |
-- |
2198 | 2198 |
|
2199 |
COMMENT ON FUNCTION lat_long_in_new_world(point util.geocoord) IS '
|
|
2199 |
COMMENT ON FUNCTION in_new_world(point util.geocoord) IS ' |
|
2200 | 2200 |
wrapper that prevents views from getting dropped when the util schema is reinstalled |
2201 | 2201 |
'; |
2202 | 2202 |
|
... | ... | |
6047 | 6047 |
analytical_stem.scrubbed_species_binomial AS "speciesBinomial", |
6048 | 6048 |
analytical_stem.scrubbed_taxon_name_with_author AS "scientificName" |
6049 | 6049 |
FROM analytical_stem |
6050 |
WHERE ((((((COALESCE((analytical_stem.geovalid_bien)::boolean, true) AND (COALESCE((analytical_stem."isNewWorld_bien")::boolean, false) OR lat_long_in_new_world(ROW(analytical_stem."decimalLatitude__@DwC__@vegpath.org", analytical_stem."decimalLongitude__@DwC__@vegpath.org")))) AND (NOT COALESCE((analytical_stem.cultivated_bien)::boolean, false))) AND (analytical_stem.scrubbed_family IS NOT NULL)) AND (analytical_stem."decimalLatitude__@DwC__@vegpath.org" IS NOT NULL)) AND (analytical_stem."decimalLongitude__@DwC__@vegpath.org" IS NOT NULL)) AND COALESCE((analytical_stem."coordinateUncertaintyInMeters__@DwC__@vegpath.org" <= _km_to_m((10)::double precision)), true));
|
|
6050 |
WHERE ((((((COALESCE((analytical_stem.geovalid_bien)::boolean, true) AND (COALESCE((analytical_stem."isNewWorld_bien")::boolean, false) OR in_new_world(ROW(analytical_stem."decimalLatitude__@DwC__@vegpath.org", analytical_stem."decimalLongitude__@DwC__@vegpath.org")))) AND (NOT COALESCE((analytical_stem.cultivated_bien)::boolean, false))) AND (analytical_stem.scrubbed_family IS NOT NULL)) AND (analytical_stem."decimalLatitude__@DwC__@vegpath.org" IS NOT NULL)) AND (analytical_stem."decimalLongitude__@DwC__@vegpath.org" IS NOT NULL)) AND COALESCE((analytical_stem."coordinateUncertaintyInMeters__@DwC__@vegpath.org" <= _km_to_m((10)::double precision)), true)); |
|
6051 | 6051 |
|
6052 | 6052 |
|
6053 | 6053 |
-- |
Also available in: Unified diff
schemas/util.sql: lat_long_in_new_world(): renamed to just in_new_world() because the lat/long is implied by the param type