How to export population data to GIS as hexagon cells you can map
Ways to export population data to GIS from xMap Flows: a CSV of every hexagon, an Excel download, rows in your own database, and how to rebuild the cells.
Part of the guide Location intelligence automation
To export population data to GIS from xMap Flows, run the Demographics block with Every hexagon and take the cells out in the format your tools read: a CSV or Excel file with each cell's index, centre and counts, or rows written straight into your own database. Each cell carries its H3 index, so any GIS that understands the H3 grid can turn the points back into proper hexagon polygons.
This is for GIS analysts, data teams and consultants who want resident counts inside their own maps and models rather than on a screen in someone else's app. It walks through what one cell holds, the four ways out, a worked example, the snags, and a flow that delivers fresh cells on a schedule.
What one cell holds
With Give back set to Every hexagon, the Demographics block returns one item per cell of about 0.1 km² (resolution 9 of the H3 grid). Each item has:
- h3_cell: the cell's index, the key to rebuild its outline.
- lat, lng: the centre of the cell.
- population, population_male, population_female and the share of men.
- age_0_9 through age_80_plus, plus children_0_19, adults_20_59 and seniors_60_plus with their shares.
- people_per_km2 and the area the cell belongs to.
One run returns up to 5,000 cells. For a large city, draw it in parts in the Area of interest and run each, or let several flows cover neighbouring districts.
Three ways to get the cells out
- CSV by email. The Email block, set to one email per run, links to a CSV of every item with every field, kept for 30 days. This is the simplest route and keeps the age groups.
- Download from the run. In the run panel, open the Demographics step's items with See all, choose the columns, and download CSV or Excel.
- Straight into a database. Save to my database writes each cell as a row into a table of your own PostgreSQL, BigQuery or Snowflake database, where a spatial extension or your GIS can pick it up.
- Into a shared sheet. For small areas, the Google Sheets app block can add each cell as a row, which some teams link to their GIS as a live table.
A worked example
Made up, to show the steps: a transport consultancy in Lyon wants residents and over-60s per hexagon inside a corridor for a tram study.
- Paste the corridor boundary as GeoJSON in the Area of interest.
- Run Demographics with Every hexagon: say it returns 1,240 cells.
- Email sends the CSV link; the analyst downloads it.
- In the GIS, load the CSV as points from lat and lng, then use an H3 tool to turn each h3_cell into its hexagon polygon.
- Style the hexagons by seniors_60_plus, and join them to the planned stops to count over-60s within 400 m of each.
Because the cells are all the same size, the consultancy can compare the corridor's two ends fairly and add up any catchment it draws later, without asking for a new extract.
Snags
- Points, not polygons. Cells arrive as centres. Rebuild the hexagons from h3_cell, or use the centres for quick point maps.
- Do not resample with a buffer. Summing cells whose centre falls inside a shape is how the block counts; doing the same in your GIS keeps your numbers in step with xMap's.
- Countries without data. The grid covers about 100 countries, among them France, Canada, India, Thailand, Egypt and Australia, but not the United Kingdom or the United States. There the export is empty and the step says so.
- Mixing resolutions. These are resolution 9 cells. Aggregate up in your GIS if you need coarser ones, never down.
- Spreadsheet surprises. Open the CSV with the H3 index as text, or a spreadsheet may mangle it.
Fresh cells on a schedule from an AI employee
- Schedule: once a quarter, or once for a single study.
- Area of interest: the districts you model, drawn or pasted.
- Demographics: Every hexagon.
- Save to my database, into the team's spatial store.
- Email: a note to the GIS team with the CSV link as a backup.
The team finds a fresh table of cells in its own database and a CSV in the inbox, ready to join to whatever layers it already maintains. The Who lives around new places and People per recycling centre, block by block templates are useful starting flows to adapt. The workflow automation guide covers how flows like this hand data on to other systems.
Questions
Can I get the hexagons as polygons directly?
The cells come as centres with their H3 index; rebuild the polygons in your GIS from h3_cell, which takes one step with any H3 tool.
Which file formats are available?
CSV and Excel from the run or the email, and rows in your own PostgreSQL, BigQuery or Snowflake database. Turning the CSV into GeoJSON or a shapefile is a one-step job in any GIS.
How many cells can one run export?
Up to 5,000 cells a run. Split a large area into parts for more.
What coordinate system are the positions in?
Latitude and longitude in decimal degrees, as GeoJSON expects.
Templates that do this
Read next
More on population and demographics · Every article · Templates