Centroid

From Open Food Facts wiki
Jump to navigation Jump to search

The centroid of a country (or area) can de defined in multiple ways. On the earth surface it is more useful to speak of the geographical center. It is possible to find lists of these centers for area's on earth. (parent page)

One quickly realises that these centers are not (always) good enough. Either they are in a location far away from population centers, or they fall in between a set of islands, etc. So we need to come up with a better estimate.

Any better estimate must reflect what we intend to achieve in the first place. We are talking about transportation and its impact. So we talk about distances, mode of transportation, the amount transported and the impact of it all. Any centroid should take this into account.

If we know only the country a product is bought in, we can either assumes the worst or the best. The worst is the maximum impact and the best the minimum impact. The minimum impact will imply transportation from the most centered location in a country.

What is now the most centered location? The distances to all other locations should be small as possible. And the usage of these distances should be as small as possible. This will take into account the population sizes of all the locations.

This seems to be a Weber problem. This problem is not solvable exactly, but must be solved iteratively. The locations are then the towns and cities in a country. And the weights are defined by the population sizes of each towns. And the distances are defined by the distances by road.

In practice it will be quite difficult to solve this for all towns in an area. But can we do it for the largest towns? And how many towns should we incorporate?

Recipe

Using the above considerations we can setup a recipe:

  1. Largest cities - find the largest cities (by population size) for a country. Star with the 5 largest cities;
  2. Population - list the population size for each of the largest cities, and calculate the fraction of the total population of all largest cities;
  3. distances - calculate the distances between all the largest cities. We can use the directions of OpenStreetMap for this;
  4. weighted distance - calculate the weighted distances, i.e. the distance times the city fraction;
  5. weighted distance sum - add all the weighted fractions for a specific city (the centroid city);
  6. minimum weighted distance sum - find the weighted distance sum that is the lowest. The corresponding city is the centroid city;
  7. add cities - more cities can be added to see whether the found centroid city is correct. For this recommence on step 1;

Result

This recipe has been applied on the following countries:

Country Centroid city quality spreadsheet
Austria Vienna 2680 link
Belgium Brussels 296 link
Czech Republic Prague 1685 link
Denmark Copenhagen 1759 link
Estonia Tallinn 2348 link
Finland Helsinki 986 link
France Paris 253 link
Germany Hannover 3800 link
Ireland Dublin 1913 link
Italy Rome 394 link
Latvia Riga 593 link
Lithuania Kaunas 34 link
Netherlands Utrecht 139 link
Norway Skien 91 link
Poland Łódź 805 link
Portugal Lisboa 12 link
Slovakia Banská Bystrica 44 link
Slovenia Ljubljana 917 link
Spain Madrid 4579 link
Sweden Nörrköping 600 link
Switzerland Olten 248 link
United Kingdom Leicester 58 link
European Union Prague 646 link

This approach of finding a centroid seems to give good results. For Belgium there is not a large difference with the geographic centroid, which is expected for a densely populated country. For Norway it is much closer to the population area's.

For small countries, it is clear that the major city should be used as Centroid. Think of Andorra, Liechtenstein, Monaco and San Marino.

 
Map of population and geographic centroids

Explanation:

  • blue pins - population centroids
  • green pins - geographic centroids
  • red pins - wikipedia centroids (barycenters)

Country Remarks

The city population centroids have been found a step by step process. This allows to see how the centroid changes after a city has been added. In general the largest city dominates the position of the centroid. And if that city is also close to the geographic centroid, it will be the centroid in the end (Belgium, Spain). If a large city is surrounded by other cities, then one of those can become the centroid (Norway, Switzerland). The layout of motorways can influence the selection between two cities (France).

Some individual country observations:

  • Austria - did not know Vienna is so large;
  • Belgium - the runnerup is Mechelen, so if more cities are added, the centroid might move towards that city along the motorway;
  • Czech Republic - the country is dominated by Prague
  • Denmark - no surprise that this is Copenhagen. This is by far the largest city of Denmark. And thus much different from the geographic centroid;
  • Finland - the country is dôminated by Helsinki;
  • France - the centroid lies along the motorway between Paris and Lyon. There are no cities that are large enough in the top 20 to push the centroid away from Paris towards Lyon. Adding Dijon did not help. Probably due to a lack of motorways to the west from Dijon;
  • Germany - the country is dominated by Berlin. Only thanks to the existence of a large town to the west, the centroid could be moved there (Hannover);
  • Italy - the centroid is dominated by Rome, but might move upwards towards Florence, when more cities in the populous north are added;
  • Ireland - the centroid is dominated by Dublin;
  • Latvia - dominated by Riga;
  • Lithuania - the medium sized cities Kaunas;
  • Netherlands - as expected in Utrecht. This is in the center of the country and also a center of motorways;
  • Norway - the centroid is in Skien, but could have been in Oslo, or in between these two cities. The centroid is much lower than the actual geographic centroid;
  • Poland - largest cities are spread out, so Łódź lies in between;
  • Portugal - the centroid is dominated by Lisbon and surrounding cities;
  • Slovakia - there are several small towns fighting to centroid. Banská Bystrica was able to fend them off;
  • Slovenia - although Ljubljana is not large, the other towns are even smaller;
  • Spain - Madrid is very well placed centrally in the country. Madrid and Barcelona are the greatest influencers on the centroid. The cities on the Canaries have been removed, but the Baleares have been kept.
  • Sweden - the country is dominated by the Oslo and surrounded cities. Due to the cities close to Denmark, the centroid is moved to the south.
  • Switzerland - Olten is one of the smaller towns in the valleys around Zurich, which dominates the centroid. Note that for transport a route through Italy is sometimes more advantageous.
  • United Kingdom - Although the UK is dominated by London, there are a lot of large cities to the north. This is the reason Leicester is the centroid.

Quality

How good are these centroids? What happens when more cities are added? How good is good enough?

Required accuracy

The eco-score label reduces every score (0-100) to just 5 levels . Each level represents a score range of 20. So the maximum bonus of 15 (which is part of the score) might change the eco-score level. Thus the accuracy required should be of the order of a bonus point.

The transportation score is multiplied by 0.15 to get the bonus points. An accuray of 1 bonus point thus implies a accuracy of 7 transportation score.

The normalisation of 2000 km for 100 transportation score points, implies 20km per transportation score points. And a a transportation score of 7 is thus 140km.

So if we get an accuracy of 100 km the centroid cities are good enough.

Actual accuracy

Can the accuracy of the centroid city be determined from the actual calculations, or their development? Every time another city is added, the centroid might change. But how likely is it that this happens. That depends on the size and relative population of the added city. And it depends on weighted distance to the runnerup centroid city. If the weighted distance is very large, adding other cities will not budge the winner city.

So calculate the difference in weighted distance between the winner centroid city and the runner-up centroid city. Divide this by the fractional size of the latest city added. This will result in a dethroning distance. This dethroning distance is the distance required to dethrone the winner city. (In practice this required distance will be much larger)

If this dethroning distance is larger than the size of the country, the winner centroid is ok. If the dethroning distance is smaller, then we have to take a closer look. As the dethroning distance will be much larger, we should only look at cases where the dethroning distance is smaller than the actual distance.

In the calculated centroids, this implies:

  • France (between Paris and Lyon)

Observations

Can this approach also be used to get an indication of country size?