# Add the area to every row of your list, then count and rank by area

Give every row in a list of places the official area it falls in, flag the ones outside, then count, rate and rank by area and download the list back.

Video: Add the area to every row of your list, then count and rank by area (1 min 21 s): /images/docs/videos/which-area-each-record-is-in.mp4

## Best for

Anyone with a list of places who has to report by area: which district each site is in, how many per district, per head, best and worst served. You need no mapping experience. You end up with your own list, row for row, with the area's code and name added, the ones outside your areas flagged, a count and a rate per area, and a file to take back into your spreadsheet or GIS.

**The example in this guide** is a real file from the City of Paris open data portal: the 1,522 Vélib' bike-share stations, each with a station code, a name, its number of docks and its location. The portal exports the location as latitude and longitude together in one text column ("48.8377016, 2.3604946"), so it was split into two columns, latitude and longitude, before the file was attached: Mapstack reads coordinates from two columns. About a third of the stations are in the towns around Paris, not in the city. Every ask below was sent with the station list.

## What you need

- **A list of places,** as a spreadsheet with addresses or with latitude and longitude in two columns, or a GIS file.
- **The areas,** by name. Mapstack fetches official boundaries and population itself; if your areas are your own, attach them as a GIS file.
- **A Free, Creator or Creator Max seat.**

## Before you start

- **Say what counts as outside.** Name the areas, and ask for the rows outside them to be flagged, not dropped. Your list comes back whole.
- **Ask for the codes as well as the names.** Codes are what you join to other tables later; names are spelt more than one way.
- **For a rate, name the population and the year you want,** or ask which year was used. Figures and boundaries should come from the same time.

## The prompt

> This is the list of Vélib' stations. Add the Paris arrondissement to each row, code and name, and flag the ones that are outside Paris. How many fall in each arrondissement?

## What to expect

1. **Mapstack places your rows**

   Your file becomes a dataset of points, one for each row, from its latitude and longitude columns: in the example all 1,522 stations were placed.

2. **It fetches the areas and finds which one each row is in**

   Mapstack looks for the boundaries in the Community Library, then in open data sources, and keeps them as a dataset of their own. It then checks each point against the areas (a spatial join) and adds the result as new columns: in the example, the arrondissement number, its INSEE code, its name (Louvre, Bourse…), a label (1er Ardt) and an inside or outside flag.

   It reports the counts: in the example, 1,000 stations inside the 20 arrondissements and 522 outside, from 15 in the 3rd to 89 in the 15th. These agree with a count made separately with the City of Paris's own arrondissement boundaries.

3. **You turn counts into rates and a ranking**

   A count mostly follows size. To compare areas fairly, divide by the people who live there:

   > Now stations and docks per 10,000 residents by arrondissement, using the latest INSEE population. Which five are best and worst served? Say which population year you used.

   Mapstack fetches the official population for the same areas, adds it as a dataset, and gives the rates, the ranking and the year. In the example it used the 2023 census: the 1st had the most stations per 10,000 residents (17.86) and the 18th the fewest (3.39). It also pointed out that ranking by docks gives a different top five, because stations differ in size. Rates for small central areas with few residents and many visitors run high, so read the ranking with that in mind.

4. **You ask about the rows outside**

   > For the stations outside Paris, which communes are they in?

   Mapstack fetches the next set of areas out, here the communes of the Métropole du Grand Paris with their population, and answers by department and commune: in the example, 240 in the Hauts-de-Seine, 151 in the Val-de-Marne, 123 in the Seine-Saint-Denis and 7 in the Val-d'Oise, with Boulogne-Billancourt the commune with the most (30), then Montreuil (23) and Issy-les-Moulineaux (22).

5. **You get your list back with the new columns**

   Ask for it. Mapstack makes one dataset with every original row and column and every column it added: here the arrondissement code, name and label, the inside or outside flag, the commune, its INSEE code and the department. Open the dataset and select **Download** to take it away; see [Download and export](/docs/share/download-and-export).

   The dataset opens on a map. To colour the points by one of the new columns, choose it under **Display**.

   ![Example: the list back as a dataset, its 1,522 Vélib' stations coloured by the added department code, Paris (75) in the middle.](/images/docs/which-area-each-record-is-in/stations-by-department-code.jpeg)

## Make it your own

> Give me the list back with the new columns so I can download it.

## Common questions

**What about places right on a boundary?**

A point on or close to a boundary can fall either side, and a park or a river can belong to an area you did not expect: in Paris, the Bois de Boulogne and the Bois de Vincennes are part of the 16th and 12th. Two sets of boundaries can also disagree by a few metres: in the example, one station in the Bois de Vincennes sits just outside the City's arrondissement outlines but inside Paris on the commune outlines, so it is among the 522 outside yet its department is Paris (75), which counts 1,001. Look at the points near a boundary on the map before you rely on their area.

**Why do some rows have no area?**

They are outside every area you named, or had no location. Ask how many, and why. Ask for rows outside your areas to be flagged, not dropped, and your list comes back whole.

**Which population year is the rate based on?**

Mapstack says which year it used. To use another, name it in the ask. Figures and boundaries should come from the same time.

**Can I use my own areas?**

Yes. Attach them as a GIS file and name them in the ask. Otherwise Mapstack fetches official boundaries itself.

**How do I check the counts?**

Ask where a figure came from, and compare the written answer with the counts in the returned dataset. Look at the highest and lowest areas too: rates for small central areas with few residents and many visitors run high.

## Related

- [Count and summarise by area](https://mapstack.io/docs/answers/count-and-summarise-by-area.md)
- [Data Mapstack can find for you](https://mapstack.io/docs/find-data/data-mapstack-finds.md)
- [Get census and official statistics](https://mapstack.io/docs/find-data/census-and-statistics.md)
- [Map a spreadsheet: addresses, coordinates or place names](https://mapstack.io/docs/your-data/spreadsheets.md)
- [Download and export](https://mapstack.io/docs/share/download-and-export.md)
- [Join your table to area boundaries and map it](https://mapstack.io/docs/guides/join-your-table-to-areas.md)
