CartoDB SQL tricks: Various things that as a SQL-newbie I had to search for >10 minutes to find answers for.
✓ Published0🌍 Public
Aandrewbt
Last edited Sep 22, 2022
Created on May 4, 2015
This example demonstrates a collection of SQL recipes for solving common spatial data problems in CartoDB, ranging from merging neighboring county polygons with ST_Union to creating great circle lines via ST_MakeLine and ST_Segmentize. It shows practical techniques like updating geometries with conditional CASE statements, extracting coordinates with ST_X and ST_Y, stripping HTML tags using regexp_replace, and formatting zip codes with to_char. The code also covers performance strategies for large updates and querying spatial relationships with st_contains. Each snippet targets PostGIS functions within the CartoDB platform, emphasizing data preparation and geometric transformations.
AI-generated description