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
| Level | Description | Typical Size |
|---|---|---|
| 0 | Country | National level |
| 1 | Major Region | States, counties, provinces |
| 2 | Local Area | Municipalities, districts |
| 3 | Sub-local Area | Neighborhoods, 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)
| Level | Swedish Name | Count | Example |
|---|---|---|---|
| 0 | Sverige (Sweden) | 1 | Sweden |
| 1 | Lan (County) | 21 | Stockholm County |
| 2 | Kommun (Municipality) | 290 | Stockholm Municipality |
| 3 | DeSO | ~5,985 | Detailed 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:
- Joining data: Match your data to census data
- Spatial aggregation: Group data by geographic area
- 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
| Resolution | Cell Area | Best 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 Case | Recommended Level |
|---|---|
| National overview | Level 1 (regions) |
| Market analysis | Level 2 (municipalities) |
| Detailed targeting | Level 3 (sub-local) |
| Performance optimization | Start 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.