I have .xlsx dataset file with column "Country Name" and "Country Code" which have text records. I would like to geocode (assign) it to adequate country polygon in batch mode. The expected result should be a polygon of the country with attributes as columns from .xlsx.


Carto.com geocoder has such function (country geocode), however it is strictly limited to couple hundreds records and I have more than 6000 of it.

I am able to use QGIS and ArcGIS.

closed as too broad by ahmadhanb, BERA, LaughU, Dan C, whyzar Feb 13 at 13:46

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Please add the GIS software that you are using. – ahmadhanb Feb 13 at 12:08
  • I am able to use QGIS and ArcGIS. – sk1me Feb 13 at 18:36

Here is one option:

  1. Download and install QGIS (free GIS software)
  2. Download a country polygon layer/shapefile that has a field that defines the names
  3. Convert xlsx to csv
  4. Add country polygon layer into Q, open attribute table, start an edit session, create two new fields called XCent, YCent and populate each field using field calculator the geometric centroid coordinate of each feature (e.g. expression x (centroid($geometry))) and save edits
  5. Load in csv into Q as a delimited text layer (no geometry) and via the layer properties perform a table join between common country name fields between both layers and export csv as a new csv containing the polygon XCent and YCent fields
  6. Load new csv into Q as a delimited text layer and use the XCent and YCent fields to plot the points

This should produce a geocode point feature for each country record (that joined successfully) in the csv. For countries with multiple records there will be many points on top of points.

  • Ok, so you propose simple attribute join, that's a good way. However you need a good dataset of country polygons (good names of the countries). What is more, I would like a polygons and I get points... – sk1me Feb 14 at 14:07
  • Yes, the country polygon layer name field values will have to match what you have in your table. You may have to make manual updates in either dataset so they match/join correctly. – artwork21 Feb 14 at 18:32

Not the answer you're looking for? Browse other questions tagged or ask your own question.