Created
June 14, 2016 16:35
-
-
Save bitner/a9098bebadca96bd08b63d657ca15356 to your computer and use it in GitHub Desktop.
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 FUNCTION public.dbs_ned_z( | |
IN text, | |
IN text, | |
OUT text) | |
RETURNS text AS | |
$BODY$ | |
#!/bin/sh | |
url="http://ned.usgs.gov/epqs/pqs.php?output=json&x=$1&y=$2"; /usr/bin/curl -s $url | |
$BODY$ | |
LANGUAGE plsh VOLATILE | |
COST 100; | |
CREATE OR REPLACE FUNCTION public.dbs_point_elevation( | |
IN geometry, | |
OUT double precision) | |
RETURNS double precision AS | |
$BODY$ SELECT (dbs_ned_z(st_x($1)::text,st_y($1)::text)::json->'USGS_Elevation_Point_Query_Service'->'Elevation_Query'->>'Elevation')::float8;$BODY$ | |
LANGUAGE sql VOLATILE | |
COST 100; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment