Spatial Analysis in 2025: Key Trends Report
| Download Now
CARTO
Platform
Overview
Visualization
Analytics
App Development
Data Enrichment
AI Agents
Enterprise & Security
Pricing
CARTO for
Google Cloud
AWS
Azure
Snowflake
Databricks
Oracle
Solutions
By Industry
By Use Case
By Role
Telecoms
Icon/indus/Insurance-menu
Icon/indus/Insurance-menu-mobile
Insurance
Logistics
Real Estate
Financial Services
Retail
Marketing & Advertising
Mobility
All industries
Network Deployment
Catastrophe Modeling
Fraud Detection
Market Analysis
Environmental Management
Site Selection
Geomarketing
Data Monetization
IoT Analytics
Supply Chain Optimization
Healthcare Analytics
Territory Planning
All use cases
Data Analyst
Data Scientist
GIS Professional
Developer
Customers
Resources
Learn
Documentation
CARTO Academy
Blog
Reports
Glossary
Connect
Events
Partners
Webinars
Log inRequest a demo
Try for free
2050-01-01
1990-01-01
"ES", "GB"

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 can I inset a map feature?

Why do I need an inset?

When creating maps, areas of interest may be separated by large irrelevant regions, forcing suboptimal zoom levels. For instance, displaying all 50 US states requires zooming out enough to include Alaska and Hawaii, which reduces detail visibility for continental areas.

In traditional print cartography, insets solve this by rendering distant regions closer to primary areas. This technique also works for digital maps.

How can I create an inset?

CARTO enables insets using SQL queries with PostGIS functions.

ST_TransScale modifies geometry by relocating it and adjusting its size simultaneously. Parameters specify:

  • The geometry to modify
  • East/West and North/South axis offsets (in SRID units)
  • Scale factors for East/West and North/South axes

ST_Transform defines projections. Using different projections for different states prevents distortion – for example, applying the Alaska Albers projection (EPSG 3338) to Alaska and Hawaii Albers projection (EPSG 102007) to Hawaii while using the North American Albers projection (EPSG 42303) for other states.

Example SQL Query

SELECT
  CASE
  WHEN name != 'Alaska' AND name != 'Hawaii'
    THEN ST_Transform(the_geom_webmercator,42303)
  WHEN name = 'Alaska'
    THEN
  ST_TransScale(
    ST_Transform(
        the_geom_webmercator
        , 3338
    )
    , -3800000
    , -900000
    , 0.7
    , 0.7
  )
  WHEN name = 'Hawaii'
    THEN
  ST_TransScale(
    ST_Transform(
        the_geom_webmercator
        , 102007
    )
    , -1200000
    , -450000
    , 1.2
    , 1.2
  )
  END the_geom_webmercator
  , cartodb_id
FROM ne_50m_admin_1_states

Note: Builder widgets cannot function on mixed SRID geometries.

CARTO
carto-logo
  • Platform

  • Overview

  • Visualization

  • Analytics

  • App Development

  • Data Enrichment

  • Security & Governance

  • Gen AI

  • Pricing

  • Solutions

  • Data Analyst

  • Developer

  • Data Scientist

  • GIS Professional

  • By Industry

  • By Use Case

  • Resources

  • Customer Stories

  • Blog

  • Glossary

  • Documentation

  • Academy

  • Reports

  • Events

  • Webinars

  • Partners

  • Company

  • About us

  • Newsroom

  • Careers

  • Brand

  • Grants

Unlock the power of spatial analysis.

youtube logofacebook logotwitter logolinkedin logo

© CARTO 2024

Terms

Privacy Notice

Whistleblower Form