A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developers.google.com/bigquery/docs/geospatial-get-started below:

Get started with geospatial analytics | BigQuery

Explore the sample data

This tutorial uses a dataset available through the Google Cloud Public Dataset Program. A public dataset is any dataset that is stored in BigQuery and made available to the general public. The public datasets are datasets that BigQuery hosts for you to access and integrate into your applications. Google pays for the storage of these datasets and provides public access to the data by using a project. You pay only for the queries that you perform on the data (the first 1 TB per month is free, subject to query pricing details.)

The NYC Citi Bike Trips dataset

NYC Citi Bike Trips

Citi Bike is the nation's largest bike share program, with 10,000 bikes and 600 stations across Manhattan, Brooklyn, Queens, and Jersey City. This dataset includes Citi Bike trips since Citi Bike launched in September 2013 and is updated daily. The data is processed by Citi Bike to remove trips that are taken by staff to service and inspect the system and any trips that are less than 60 seconds in duration, which are considered false starts.

You can start exploring this data in the BigQuery console by viewing the details of the citibike_stations table:

Go to citibike_stations schema

Three columns in this table are relevant to this tutorial:

Query the bike stations with more than 30 bikes available

In this section of the tutorial, you run a GoogleSQL query that finds all the Citi Bike stations in New York City with more than 30 bikes available to rent.

Query details

The following GoogleSQL query is used to find the Citi Bike stations with more than 30 bikes.

SELECT
  ST_GeogPoint(longitude, latitude)  AS WKT,
  num_bikes_available
FROM
  `bigquery-public-data.new_york.citibike_stations`
WHERE num_bikes_available > 30

The query clauses do the following:

Run the query

To run the query by using the Google Cloud console:

  1. Go to the BigQuery page in the Google Cloud console.

    Go to the BigQuery page

  2. Enter the following GoogleSQL query in the Query editor text area.

    -- Finds Citi Bike stations with > 30 bikes
    SELECT
      ST_GeogPoint(longitude, latitude)  AS WKT,
      num_bikes_available
    FROM
      `bigquery-public-data.new_york.citibike_stations`
    WHERE num_bikes_available > 30
  3. Click Run.

    The query takes a moment to complete. After the query runs, your results appear in the Query results pane.

Visualize the results in BigQuery

To visualize the results in an interactive map, follow these steps:

  1. In the Query results pane, click Visualization.

    The points on the map show the locations of each bike station.

  2. You can apply uniform or data driven styling to your map. To visualize how many bikes are available at each station, for Data column select num_bikes_available.

  3. To improve visibility, try adjusting the Opacity, Color, or Point size. If your data contains outliers, you can adjust the Min and Max values. Geographies with values outside this range are still displayed on the map, but no color is applied.

  4. To view the properties of a geography, click it.

  5. To view the map in satellite mode, click Satellite.

Visualize the query results in Geo Viz

You can also visualize your results using BigQuery Geo Viz: a web tool for visualization of geospatial data in BigQuery using Google Maps APIs.

Launch Geo Viz and authenticate

Before using Geo Viz, you must authenticate and grant access to data in BigQuery.

To set up Geo Viz:

  1. Open the Geo Viz web tool.

    Open the Geo Viz web tool

    You might need to enable cookies to authorize and use this tool.

  2. Under step one, Query, click Authorize.

  3. In the Choose an account dialog, click your Google Account.

  4. In the access dialog, click Allow to give Geo Viz access to your BigQuery data.

Run a GoogleSQL query on geospatial data

After you authenticate and grant access, the next step is to run the query in Geo Viz.

To run the query:

  1. For step one, Select data, enter your project ID in the Project ID field.

  2. In the query window, enter the following GoogleSQL query.

    -- Finds Citi Bike stations with > 30 bikes
    SELECT
      ST_GeogPoint(longitude, latitude)  AS WKT,
      num_bikes_available
    FROM
      `bigquery-public-data.new_york.citibike_stations`
    WHERE num_bikes_available > 30
  3. Click Run.

  4. When the query completes, click Show results. You can also click step two Define columns.

  5. This moves you to step two. In step two, for Geometry column, choose WKT. This plots the points corresponding to the bike stations on your map.

Format your visualization

The Style section provides a list of visual styles for customization. Certain properties apply only to certain types of data. For example, circleRadius affects only points.

Supported style properties include:

Each style can be given either a global value (applied to every result) or a data-driven value (applied in different ways depending on data in each result row). For data-driven values, the following are used to determine the result:

To format your map:

  1. Click Add styles in step two or click step 3 Style.

  2. Change the color of your points. Click fillColor.

  3. In the Value field, enter #0000FF, the HTML color code for blue.

  4. Click Apply Style.

  5. Examine your map. If you click one of your points, the value is displayed.

  6. Click fillOpacity.

  7. In the Value field, enter 0.5 and click Apply Style.

  8. Examine your map. The fill color of the points is now semi-transparent.

  9. Change the size of the points based on the number of bikes available. Click circleRadius.

  10. In the circleRadius panel:

    1. Click Data driven.
    2. For Function, choose linear.
    3. For Field, choose num_bikes_available.
    4. For Domain, enter 30 in the first box and 60 in the second.
    5. For Range, enter 5 in the first box and 20 in the second.

  11. Examine your map. The radius of each circle now corresponds to the number of bikes available at that location.

  12. Close Geo Viz.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4