Created
December 16, 2022 17:15
-
-
Save wriglz/18330f3f7857e8ba157cd8126985973b to your computer and use it in GitHub Desktop.
Function to create a UDF to replicate ST_LineLocatePoint on Google BigQuery
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 | |
demo.ST_LineLocatePoint(line GEOGRAPHY, | |
point GEOGRAPHY) | |
RETURNS FLOAT64 AS (ST_DISTANCE(ST_STARTPOINT(line),ST_CLOSESTPOINT(line, point) )/ST_LENGTH(line) ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment