MAKEPOINT([Lat], [Lon]) turns two coordinate columns into a point you can map. Tableau takes latitude first; SQL spatial functions take longitude first: DuckDB ST_Point(Lon, Lat), Snowflake ST_MAKEPOINT(Lon, Lat). A missing coordinate gives no point at all. The runnable SQL builds the same GeoJSON the engine returns with json_object, because this page's DuckDB has no spatial extension. With the extension loaded, the DuckDB call is shown in the FAQ.
Updated · Checked on the xmetric engine
What is the syntax?
MAKEPOINT(latitude, longitude)
latitude
degrees north, from -90 to 90.
longitude
degrees east, from -180 to 180.
Returns a spatial point (WGS84). Null when either coordinate is null.
What does it return, and what is the SQL?
Each example runs on the same 4 sample rows twice: the Tableau formula on the xmetric engine, and the SQL in DuckDB.
Where is each depot?
Tableau
MAKEPOINT([Lat], [Lon])
SQL (DuckDB)
SELECTCASEWHEN Lat ISNULLOR Lon ISNULLTHENNULLELSEjson_object('type', 'Point', 'coordinates', [Lon, Lat])
ENDAS result
FROM input
ORDERBY id
The GeoJSON coordinates are [longitude, latitude]. Hue has no longitude, so it gets no point.
Lat
Lon
Result
10.78
107
[object Object]
21.03
106
[object Object]
16.05
108
[object Object]
16.46
null
✓ The Tableau formula and the SQL return the same 4 rows.
Where is each delivery going?
Tableau
MAKEPOINT([DestLat], [DestLon])
SQL (DuckDB)
SELECTCASEWHEN DestLat ISNULLOR DestLon ISNULLTHENNULLELSEjson_object('type', 'Point', 'coordinates', [DestLon, DestLat])
ENDAS result
FROM input
ORDERBY id
Every row has both destination coordinates.
DestLat
DestLon
Result
10.05
106
[object Object]
20.84
107
[object Object]
16.46
108
[object Object]
15.88
108
[object Object]
✓ The Tableau formula and the SQL return the same 4 rows.
Where does a straight translation go wrong?
Common mistake
Why does a hand-built point exist for a row with no longitude?
MAKEPOINT returns null when a coordinate is missing, so Hue has no point. json_object builds an object anyway, with a null inside, and the row looks mapped. Return null when either coordinate is null; DuckDB's ST_Point does that on its own.
Tableau
ISNULL(MAKEPOINT([Lat], [Lon]))
Tempting SQL
SELECTjson_object('type', 'Point', 'coordinates', [Lon, Lat]) ISNULLAS result
FROM input
ORDERBY id
SQL that matches
SELECT Lat ISNULLOR Lon ISNULLAS result
FROM input
ORDERBY id
Lat
Lon
Tableau
Tempting SQL
SQL that matches
10.78
107
false
false
false
21.03
106
false
false
false
16.05
108
false
false
false
16.46
true
false
true
✓ The SQL that matches returns the Tableau result on every row; the marked cells are where the tempting SQL differs.
How do I write it in Snowflake or BigQuery?
The first example, written for each warehouse from its documentation. These are not run here; DuckDB is.
Snowflake
SELECTST_MAKEPOINT(Lon, Lat) AS result
FROM input
ORDERBY id
Tableau's MAKEPOINT takes latitude first. SQL spatial functions and WKT take x first, which is longitude: DuckDB ST_Point(Lon, Lat), Snowflake ST_MAKEPOINT(Lon, Lat), BigQuery ST_GEOGPOINT(Lon, Lat). Swapping them puts Saigon (10.78 N, 106.70 E) off the map, since 106.70 is not a valid latitude.
What is the DuckDB call with the spatial extension?
INSTALL spatial; LOAD spatial; then ST_Point(Lon, Lat), which returns a GEOMETRY. ST_AsGeoJSON turns it into the same GeoJSON shown here.