Reputation: 591
I have a table having all areas with their covered polygons.
area_name, polygon
Now i want to write a query to fetch all the polygons within 60km radius of specific point(lng/lat)
Thanks in advance
Upvotes: 2
Views: 917
Reputation: 172974
Consider below toy example of looking for all zip codes within the 10km from Los Angeles Disneyland Park
SELECT point, zipcode, ST_GEOGFROMTEXT(zipcode_geom) zip_geom
FROM `bigquery-public-data.utility_us.zipcode_area`,
UNNEST([ST_GEOGPOINT(-117.9190, 33.8121)]) point
WHERE state_code = 'CA'
AND ST_DWITHIN(ST_GEOGFROMTEXT(zipcode_geom), point, 10000)
the output is 36 zip codes like below
if to visualize this result - you get below
Upvotes: 2