Reputation: 39
I have the latitude and the longitude of some locations and I was wondering whether there is a way in BQ to link them to zipcodes. If it makes any difference, I am interested in Europe, and I need the zipcodes for Netherlands and Spain.
Upvotes: 0
Views: 2589
Reputation: 59175
If you have a database with the geometry of each zipcode:
WITH data AS (
SELECT ST_GEOGPOINT(-122.4194, 37.7749) point
UNION ALL
SELECT ST_GEOGPOINT(-74.0060, 40.7128) point
)
SELECT zip_code, city, county
FROM `bigquery-public-data.geo_us_boundaries.zip_codes`
JOIN data
ON ST_WITHIN(point, zip_code_geom)
I used US data for this example - do you have a database of European zipcodes?
Upvotes: 4