Search code examples
google-bigquery

Query geospatial data with BigQuery


Hi I would like to obtain a list of public locations (restaurant, hotels, cinema etc.) neighbours based on GPS coordinates. Is this possible with BigQuery ?


Solution

  • If you have lat-lon or GPS coordinates as columns, you could definitely grab rectangular regions from BigQuery using WHERE comparisons on the coordinates and then aggregate on the selected rows.

    The scalar operations available in BigQuery are pretty powerful too -- you can add a variety of arithmetic functions to your query and still get excellent performance.

    You find listed example queries on the linked page:

    • Return a collection of points within a rectangular bounding box centered around San Francisco (37.46, -122.50).
    • Return a collection of up to 100 points within an approximated circle determined by the using the Spherical Law of Cosines, centered around Denver Colorado (39.73, -104.98).