I looking for Shapefile of a World countries having an attribute of the national currency, do you know how can I get that ?
-
As in "this is UK, national currency is pound"?– ErikCommented Aug 22, 2019 at 15:37
-
1Your best bet is probably to just use a shapefile of country borders and then join or relate a table of currency type by country.– lambertjCommented Aug 22, 2019 at 15:50
-
@lambertj I guess so sir, I just wanted to know if it was already avalaible in some Website– EliasseCommented Aug 22, 2019 at 15:57
-
2If it’s open data that you seek then I think the place to ask is the Open Data Stack Exchange.– PolyGeo ♦Commented Aug 22, 2019 at 20:29
-
I did not know it, thanks a lot !– EliasseCommented Aug 23, 2019 at 16:50
1 Answer
Here is how I made the file for you:
Got tabular data with country names, currency, and currency code from github here: https://gist.github.com/HarishChaudhari/4680482#file-country-code-to-currency-code-mapping-csv
Downloaded country layer from ESRI here:https://hub.arcgis.com/datasets/a21fdb46d23e4ef896f31475217cbb08_1
Change ESRI .dbf table to .csv table, edit name fields so that they match in both tables.
Merge tables using common ID field in R, then export table as .dbf using package foreign to overwrite the orginal .dbf.
library(foreign)
#input tables
df.1 <- read.csv('countries.csv')
df.2 <- read.csv('currency.csv')
#Join tables
m = merge(df.1, df.2, by="Country")
#overwrite attribute table
write.dbf(m, file = "Countries_WGS84.dbf")
Here is the link to the new shapefile: https://drive.google.com/drive/folders/1D9v2DDO48mCbX22ga7hrz0ot4GccAx0D?usp=sharing
-
1Well, I was not asking for that much. Thanks a lot for the specific details I appreciate it. I joined the field with a simple join in QGIS because I don't have the R thing, I was looking a few time ago how to install R thing to use it with QGIS I think I will give another shot. Thumbs up !– EliasseCommented Aug 22, 2019 at 18:38
-
Just one thing, FME warns me that the DBF and the SHP do not match as it seems that the DBF contains fewer records than the SHP. Also there is a problem in the files you shared in Google Drive, when I look in the attribute table I see that AMERICAN SAMOA as EUROS as CURRENCY ? It seems to me that there is some things to fix. But in the general way thanks for having detailed the procedure, and for the R code.– EliasseCommented Aug 22, 2019 at 19:33