This content applies to a previous version of CARTO
In October 2021 we released a new version of our platform. You can find the latest documentation at docs.carto.com
Back to Help Center
How to Create Straight Lines Between Points
Use SQL to connect points with straight lines.
You can use the ST_MakeLine PostGIS function to establish connections between geographic points via lines in SQL:
SELECT a.cartodb_id,
ST_MakeLine(
a.the_geom_webmercator,
b.the_geom_webmercator
) as the_geom_webmercator,
a.name as origin,
b.name as destination
FROM ( SELECT *
FROM populated_places
WHERE name = 'Paris'
) as a,
( SELECT *
FROM populated_places
WHERE name = 'Madrid'
) as b
