Skip to main content
cesteralDocs
FAQContact

Geographic Levels

Understanding administrative boundaries and geographic hierarchies

Last updated 7 Jan 2025Reference · article 6 of 9

Geographic levels define the administrative boundaries used for census data. Understanding these levels is essential for effective spatial analysis.

Level System

Cesteral Intelligence uses a universal level system that works across countries. This enables consistent queries regardless of local administrative terminology.

Level Hierarchy

LevelDescriptionTypical Size
0CountryNational level
1Major RegionStates, counties, provinces
2Local AreaMunicipalities, districts
3Sub-local AreaNeighborhoods, census tracts

Benefits of Universal Levels

  • Cross-country analysis: Same queries work for any country
  • Consistent APIs: No need to know local administrative names
  • Future-proof: Adding new countries doesn't require code changes

Country-Specific Mappings

Sweden (SWE)

LevelSwedish NameCountExample
0Sverige (Sweden)1Sweden
1Lan (County)21Stockholm County
2Kommun (Municipality)290Stockholm Municipality
3DeSO~5,985Detailed statistical areas

About DeSO Areas:

  • Demographic Statistical Areas (DeSO)
  • Average size: ~0.7 km²
  • Population range: 700-2,700 residents
  • Designed for statistical stability

Other Countries (Coming Soon)

We're expanding coverage to include:

  • Norway: Fylke → Kommune → Grunnkrets
  • Denmark: Region → Kommune → Sogn
  • Finland: Maakunta → Kunta → Postinumeroalue

Working with Levels

Querying by Level

Select all areas at a specific level:

Country: SWE
Level: 2
→ Returns all 290 Swedish municipalities

Querying with Parent

Find all sub-areas within a parent:

Country: SWE
Parent: 01 (Stockholm County)
Include Descendants: true
→ Returns all municipalities and DeSO areas in Stockholm County

Limiting Depth

Control how many levels down to search:

Country: SWE
Parent: 01
Include Descendants: true
Max Depth: 1
→ Returns only direct children (municipalities), not DeSO areas

Area Codes

Code Structure

Area codes uniquely identify geographic areas. The format varies by country:

Sweden:

  • Level 1 (County): 2 digits (01, 14)
  • Level 2 (Municipality): 4 digits (0180, 1480)
  • Level 3 (DeSO): 8 characters (0180C1010)

Code Properties

Each area code has:

  • Unique identifier: No duplicates within a country
  • Parent reference: Links to containing area
  • Path: Full hierarchy from country down

Using Area Codes

Area codes are the key for:

  1. Joining data: Match your data to census data
  2. Spatial aggregation: Group data by geographic area
  3. Hierarchical queries: Navigate up/down the hierarchy

Geographic Boundaries

Boundary Data

Each area has an associated geometry:

  • Polygon: The actual boundary shape
  • Centroid: Center point of the area
  • Bounding box: Rectangular extent

Coordinate System

All geometries use:

  • CRS: WGS84 (EPSG:4326)
  • Format: GeoJSON compatible
  • Precision: Suitable for mapping

H3 Spatial Indexing

For performance, we also index areas using H3 hexagonal cells.

What is H3?

H3 is a hierarchical hexagonal grid system:

  • Consistent shapes: All cells are approximately equal size
  • Fast queries: Efficient spatial lookups
  • Multiple resolutions: From global to neighborhood scale

H3 Resolution Reference

ResolutionCell AreaBest For
5~252 km²Country/region level
6~36 km²County level
7~5.2 km²Municipality level
8~0.74 km²DeSO/neighborhood level

When to Use H3

Use H3 for:

  • Fast spatial filtering
  • Heatmap visualizations
  • Approximate spatial joins
  • Zoom-based data loading

Use precise boundaries for:

  • Exact point-in-polygon tests
  • Official statistics
  • Distance calculations
  • Legal/administrative purposes

Practical Examples

Finding Areas in a Region

To get all municipalities in Stockholm County:

Query:
  country: "SWE"
  parentArea: "01"
  level: 2

Returns: Stockholm, Huddinge, Solna, Sundbyberg, etc.

Getting Area Details

To get information about a specific area:

Query:
  country: "SWE"
  areaCode: "0180"

Returns:
  name: "Stockholm"
  level: 2
  parent: "01"
  population: 984,748
  geometry: {...}

Hierarchical Navigation

To understand where an area fits:

Area: 0180C1010 (a DeSO in Stockholm)
Path: SWE → 01 → 0180 → 0180C1010
       ↓    ↓     ↓        ↓
   Country County Municipality DeSO

Best Practices

Choosing the Right Level

Use CaseRecommended Level
National overviewLevel 1 (regions)
Market analysisLevel 2 (municipalities)
Detailed targetingLevel 3 (sub-local)
Performance optimizationStart coarse, drill down

Handling Boundary Changes

Administrative boundaries change over time:

  • Check effective dates: Use current boundaries for current data
  • Historical analysis: Note which boundaries were in effect
  • Document your choices: Record which boundary version you used

Performance Considerations

  • Query at the highest useful level: Don't fetch DeSO data if municipalities suffice
  • Use H3 for interactive maps: Switch to precise boundaries for exports
  • Cache frequently used areas: Avoid re-fetching static data

Troubleshooting

Area Code Not Found

  • Verify the code format matches the expected pattern
  • Check if the area still exists (may have been merged)
  • Ensure you're using the correct country code

Hierarchy Mismatch

  • Confirm parent-child relationships are correct
  • Check if boundary changes affected the hierarchy
  • Validate against official administrative lists

Geometry Issues

  • Ensure your data uses WGS84 coordinates
  • Check for antimeridian crossing issues
  • Verify polygon orientation (exterior rings counter-clockwise)

Related articles

Still stuck? Browse the FAQ or contact us.