# How to reproduce an ArcGIS map projection with layers

**URL:** <https://discourse.julialang.org/t/how-to-reproduce-an-arcgis-map-projection-with-layers/73277>\
**Category:** New to Julia\
**Tags:** geostatistics\
**Created:** [December 17, 2021, 5:49pm UTC](https://discourse.julialang.org/t/how-to-reproduce-an-arcgis-map-projection-with-layers/73277 "2021-12-17T17:49:53Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![YummyPampers2](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yummypampers2/32/27328_2.png) [@YummyPampers2](https://discourse.julialang.org/u/YummyPampers2)\
**Post date:** [December 17, 2021, 5:49pm UTC](https://discourse.julialang.org/t/how-to-reproduce-an-arcgis-map-projection-with-layers/73277/1 "2021-12-17T17:49:53Z")

</div>

Hello Watchers:

My intention is to produce something  
similar to a question I presented a  
colleague days ago [THREAD](https://discourse.julialang.org/t/practical-spatial-analysis-packages-in-julia/73177/4) that looks  
like this:

![image](https://global.discourse-cdn.com/julialang/original/3X/1/7/17dd62d30969b48d75e06b2cd278ea875bbcd8cb.png)

The goal is two-fold:

1. Highlight regions of interest within a  
country.
2. Add annotations at centroids within those  
regions to explain certain characteristics of  
those regions.
  - An annotation in a card would be  
better for presentation purposes if  
possible.

Progress:

I am using Pluto, Julia v 1.7.\*.  
I have started pursuing the goal  
with the following code:

```julia
NZL = GeoTables.gadm("NZL", children = true)
viz(NZL.geometry, decimation = 0.10, color = 1:nelements(NZL.geometry), 
    showboundary=true, colormap = :viridis)

```

I changed the decimation from 0.02 to 0.10  
because the former had a skewed display  
output. This code however is occupying a  
bit of RAM after executing fairly quickly  
initially. I have no background programs  
running with the exception of some browser  
tabs – yet the kernel run-time is at:

![image](https://global.discourse-cdn.com/julialang/original/3X/a/5/a52950189c3d46575cd6d16b31cbebf352b9e04d.png)

Presentation-level Question:

Are there any wrappers that allow for  
interactive displays? (i.e., something  
that might work similarly to PlotlyJS).

Disclaimer:

I have searched this listing [here](https://github.com/svaksha/Julia.jl/blob/master/Earth-Science.md) and understand the  
general ideas about projections, coordinate systems,  
and geographic data storage types.

However, these modules are not practical in my view.  
They often use over-simplified examples, and do not  
generally explain basic steps for importing or general  
GeoJSON, .shp, .csv sources, for selecting appropriate  
wrappers, or for achieving some level of presentation  
quality for non-technical audiences.

---

<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:** [December 21, 2021, 2:46am UTC](https://discourse.julialang.org/t/how-to-reproduce-an-arcgis-map-projection-with-layers/73277/2 "2021-12-21T02:46:50Z")

</div>

A quick example with GMT (see more examples [this example](https://www.generic-mapping-tools.org/GMT.jl/dev/gallery/GADM/gadm/)).  
Texts give a little more work because you need to know the coordinates where to plot them.

```julia
using GMT

NZL = gadm("NZL", children=true);
plot(NZL, region=(166,179,-47.5,-34), proj=:guess, fill=:lightblue, lw=0.5)
plot!(gadm("NZL", "Canterbury"), fill=:blue, lw=0.5, show=true)

```

 ![GMTjl_tmp-fs8](https://global.discourse-cdn.com/julialang/original/3X/7/f/7f8988260433012665e413cff1c51b4088914b03.png)

---

<div class="post-metadata">

**Author:** ![YummyPampers2](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yummypampers2/32/27328_2.png) [@YummyPampers2](https://discourse.julialang.org/u/YummyPampers2)\
**Post date:** [December 23, 2021, 8:18pm UTC](https://discourse.julialang.org/t/how-to-reproduce-an-arcgis-map-projection-with-layers/73277/3 "2021-12-23T20:18:14Z")

</div>

@joa-quim Thank you!

This is practical and I appreciate your effort.

Regarding the text, as a starting point do  
you think I should find a city in these provinces  
to use as centroids then make subtle adjustments  
to improve visibility?

Should I assign the text in the header of the code  
block, then add to the plot function?

Thank you again,

---

<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:** [December 24, 2021, 1:26am UTC](https://discourse.julialang.org/t/how-to-reproduce-an-arcgis-map-projection-with-layers/73277/4 "2021-12-24T01:26:21Z")

</div>

> [@YummyPampers2](#):
>
> Should I assign the text in the header of the code  
> block, then add to the plot function?

From this answer I suspect that you failed to acknowledge that GMT.jl is a different package then Plots.

Yes, you can compute the centroids but the problems is that many _districts_ have several polygons (just look at the several islands in the above plot) and thus some decision would have to be made on what centroid is the most representative. Then you can try the [GMT.jl text module](https://www.generic-mapping-tools.org/GMT.jl/dev/text/).

---

<div class="post-metadata">

**Author:** ![YummyPampers2](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yummypampers2/32/27328_2.png) [@YummyPampers2](https://discourse.julialang.org/u/YummyPampers2)\
**Post date:** [December 26, 2021, 10:30pm UTC](https://discourse.julialang.org/t/how-to-reproduce-an-arcgis-map-projection-with-layers/73277/5 "2021-12-26T22:30:46Z")

</div>

Understood – are you receiving prompt  
requesting GMTinstaller.exe to make  
changes to your machine? The publisher  
is unknown.

---

<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:** [December 27, 2021, 2:26pm UTC](https://discourse.julialang.org/t/how-to-reproduce-an-arcgis-map-projection-with-layers/73277/6 "2021-12-27T14:26:40Z")

</div>

That’s GMT being installed. It changes the user’s path.

---

<div class="post-metadata">

**Author:** ![YummyPampers2](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yummypampers2/32/27328_2.png) [@YummyPampers2](https://discourse.julialang.org/u/YummyPampers2)\
**Post date:** [December 27, 2021, 10:42pm UTC](https://discourse.julialang.org/t/how-to-reproduce-an-arcgis-map-projection-with-layers/73277/7 "2021-12-27T22:42:08Z")

</div>

Alright, thank you –
