Reverse- geocoding: How to determine the city closest to a (lat,lon) with BigQuery SQL?
问题 I have a huge collection of points - and I want to determine the closest city to each point. How can I do this with BigQuery? 回答1: This is the best performing query we've worked out so far: WITH a AS ( # a table with points around the world SELECT * FROM UNNEST([ST_GEOGPOINT(-70, -33), ST_GEOGPOINT(-122,37), ST_GEOGPOINT(151,-33)]) my_point ), b AS ( # any table with cities world locations SELECT *, ST_GEOGPOINT(lon,lat) latlon_geo FROM `fh-bigquery.geocode.201806_geolite2_latlon_redux` )