# Join dataframe and geotable

**URL:** <https://discourse.julialang.org/t/join-dataframe-and-geotable/112138>\
**Category:** New to Julia\
**Tags:** geostat\
**Created:** [March 26, 2024, 12:03pm UTC](https://discourse.julialang.org/t/join-dataframe-and-geotable/112138 "2024-03-26T12:03:22Z")\
**Posts on this page:** 1\
**Showing post:** 18

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [March 28, 2024, 5:40pm UTC](https://discourse.julialang.org/t/join-dataframe-and-geotable/112138/18 "2024-03-28T17:40:19Z")

</div>

Let me show an alternative with GMT.jl that does not involve joins.

I know about the parallel topic going under [Add a colorbar to a viz in GeoStats](https://discourse.julialang.org/t/add-a-colorbar-to-a-viz-in-geostats/112193/13) but given it’s more specific title I don’t want to hijack it.

For this example I downloaded a similar shape file an renamed it .shp.zip to easy up the reading. Other variables are coming from that other thread.

```julia
using GMT

# Load the shape file
LAs = gmtread("CTYUA_DEC_2023_UK_BFE.shp.zip");

# Codes for Londonf Boroughs
LADcode=["E09000033", "E09000009", "E09000021", "E09000019", "E09000024", "E09000012", "E09000007", "E09000032", "E09000010", "E09000028", "E09000001", "E09000022", "E09000017", "E09000030", "E09000020", "E09000011", "E09000014", "E09000027", "E09000018", "E09000015", "E09000023", "E09000013", "E09000025", "E09000031", "E09000008", "E09000005", "E09000026", "E09000003", "E09000006", "E09000002", "E09000016", "E09000029", "E09000004"];

# Some other data for the choropleth
Total_Awarded=[1551248258, 110166558, 38033540, 865003501, 46621989, 395602425, 915273792, 197296888, 86772623, 573171051, 321575633, 665770100, 39514648, 374049415, 307431197, 812345843, 181261693, 176262413, 131028168, 48236040, 173721339, 257659057, 246970981, 95473179, 86525712, 304128061, 77681457, 82934564, 88862200, 63604751, 46974062, 42463929, 41183878];

subpop=[205087, 366127, 167845, 216767, 215324, 259956, 210390, 328367, 329601, 306374, 8618, 317498, 304792, 312273, 143940, 289254, 264130, 195232, 287940, 260987, 299810, 183295, 350626, 278050, 390506, 338918, 309836, 388639, 329830, 218534, 262022, 209517, 246543];

# Select only the polygons of the London Boroughs. (Note that in this shapefile the key name is "CTYUA23CD" and not "LADcode")
Dlond = filter(LAs, CTYUA23CD = Tuple(LADcode));

rat = Total_Awarded ./ subpop ./ (sum(Total_Awarded) / sum(subpop));

# Get the extrema of the log10
extrema(log10.(rat))
(-0.9181242361240128, 1.5409978534680409)

# Make a logarithimic colormap with fixed values (not data dependent as requested in that other thread)
C = makecpt(range=(-1,1.6), log=true, cmap="hawaii");

# Show it
viz(Dlond, level=rat, cmap=C, lw=0.1, colorbar=(cmap=C, log=true, frame=:auto))

```

 ![Lond](https://global.discourse-cdn.com/julialang/original/3X/b/d/bd5e5921a6c202fd666422211856e26deb84af22.jpeg)

---

_[View the full topic](https://discourse.julialang.org/t/join-dataframe-and-geotable/112138)._
