Map Chart

Map charts can display data on a map using latitude/longitude, geohash, geocodes, and GeoJSON

Data Formats

Map charts can display the following data formats on a map.

Latitude/Longitude

Draws objects at the specified latitude and longitude coordinates. Latitude and longitude should be specified as numeric columns. Available for the following render types:

  • Pin

  • Bubble

  • Heatmap

  • Flow

    • Requires two sets (source and target) of latitude/longitude information

Geohash

Draws objects at positions specified in Geohash format.

For the following render types, objects are drawn at the center of the specified geohash:

  • Pin

  • Bubble

  • Heatmap

For the following render type, the area of the specified geohash is filled and drawn: (The size of the filled area varies depending on the precision of the specified geohash)

  • Mesh

Geohash Examples

Below are examples of geohashes at different precision levels.

Geohash
Precision
Example Location
Area Size (approx.)

xn

2 characters

Tokyo area

630km × 500km

xn7

3 characters

Central Tokyo

78km × 78km

xn76

4 characters

Tokyo Station area

20km × 10km

xn76u

5 characters

Around Tokyo Station

2.4km × 2.4km

xn76ur

6 characters

Near Tokyo Station

610m × 300m

xn76urx

7 characters

Tokyo Station vicinity

76m × 76m

xn76urxk

8 characters

Around Tokyo Station

19m × 9m

BigQuery Usage Example

In BigQuery, you can use the ST_GEOHASH function to convert latitude and longitude data into geohashes. By converting to geohashes, you can efficiently aggregate and group data by area, rather than handling latitude and longitude individually.

Below is an example of using BigQuery's ST_GEOHASH function to convert latitude and longitude data into geohashes.

SELECT
  ST_GEOHASH(ST_GEOGPOINT(longitude, latitude), 6) AS geohash,
  COUNT(*) AS station_count
FROM
  `bigquery-public-data.new_york_citibike.citibike_stations`
GROUP BY
  geohash
ORDER BY
  station_count DESC

Geocode

Fills and draws the area associated with a geocode. Available for the following render type:

  • Area

Geocodes should be specified as strings in the following format:

Granularity
Geocode Format
Geocode Example

Country

2-letter country code (ISO3166-1, uppercase)

US

Prefecture (Japan only)

"JP-"+2-digit prefecture code (JIS X 0402)

JP-13

Municipality (Japan only)

"JP-"+5-digit municipality code (JIS X 0402)

JP-13101

First 2 digits of postal code (Japan only)

"JP-POST-"+first 2 digits of postal code

JP-POST-10

First 3 digits of postal code (Japan only)

"JP-POST-"+first 3 digits of postal code

JP-POST-100

The geospatial data used for filling is a lightweight version processed from the following data:

Note that even if a geocode format is valid, geocodes not included in the above data cannot be drawn.

Geocode Samples

The following are sample geocodes. For a list of available geocodes, please refer to the Geocode List CSV file.

Geocode
Name

US

United States

JP

Japan

JP-01

Hokkaido

JP-02

Aomori Prefecture

JP-03

Iwate Prefecture

JP-01100

Sapporo City

JP-01101

Sapporo City, Chuo Ward

JP-01102

Sapporo City, Kita Ward

JP-01103

Sapporo City, Higashi Ward

JP-01202

Hakodate City

JP-01203

Otaru City

JP-01204

Asahikawa City

JP-POST-10

〒10X-XXXX

JP-POST-100

〒100-XXXX

GeoJSON

Draws GeoJSON-formatted geometry data on a map. Available for the following render types:

  • Polygon

  • Polyline

Specify JSON of the following geometry types as string type:

  • Point

  • LineString

  • Polygon

  • MultiPoint

  • MultiLineString

  • MultiPolygon

  • GeometryCollection

GeoJSON Sample

{
  "type": "Polygon",
  "coordinates": [
    [
      [-73.9812, 40.7681],
      [-73.9581, 40.7681],
      [-73.9581, 40.8007],
      [-73.9812, 40.8007],
      [-73.9812, 40.7681]
    ]
  ]
}

BigQuery Usage Example

In BigQuery, you can use the ST_ASGEOJSON function to convert geometry data to GeoJSON format. The following example converts the county_geom column from the bigquery-public-data.geo_us_boundaries.counties table to GeoJSON format.

SELECT
  * EXCEPT (county_geom),
  ST_ASGEOJSON(county_geom) AS county_geom
FROM
  `bigquery-public-data.geo_us_boundaries.counties`
WHERE
  state_fips_code = '36'  -- New York

If the size of the geometry data to be drawn is large, it may exceed the query result size limit and cause an error. In such cases, you can use the ST_SIMPLIFY function to simplify the geometry data and reduce its size. (We recommend simplifying large geometry data to the minimum necessary size, as it can also affect rendering performance)

SELECT
  * EXCEPT (county_geom),
  ST_ASGEOJSON(ST_SIMPLIFY(county_geom, 1000)) AS county_geom
FROM
  `bigquery-public-data.geo_us_boundaries.counties`
WHERE
  state_fips_code = '36'  -- New York

Usage Limitations

Since map charts use WebGL to render maps, the following limitations apply:

  • Cannot be rendered in browsers that do not support WebGL

  • Due to WebGL context number limitations, when attempting to render many map charts simultaneously, previously rendered charts may be discarded

    • They can be re-displayed by re-rendering, but please be careful not to have too many map charts per page

Last updated

Was this helpful?