# Coordinates for multiple countries

I am trying to plot polygons for multiple countries, say "UnitedStates" and "Canada". US data is generated thus:

coordsUS = CountryData["UnitedStates", "Coordinates"]


coordsCanada = CountryData["Canada", "Coordinates"]


I want to pass the combination of these two lists into the routines on this page. I cannot figure out how to combine these two lists into a single list of the same structure. The structure is:

{{{a,b},{c,d},{e,f}}}


I know how to combine lists of the following form:

{{a,b},{c,d},{e,f}}


but the extra depth is confounding me. I try putting the latter into a list thus:

l = {{a,b},{c,d},{e,f}}
z = {l}


but that does not work. AppendTo does not work either.

Help is appreciated. Thanks!

-Tony

-

If your aim is just to plot Canada and the United States, "SchematicPolygon" may be what you want. You could use:

canus = {usa,
Graphics[canus]


If you want to get the polygon coordinates, and display both (you can use Join):

canusp = Join @@ (canus /. Polygon[x__] :> x);
Graphics[{FaceForm[None], EdgeForm[Red], Polygon[canusp]}]


You can choose whatever styling suits your needs.

Apologies if I have misunderstood your question.

-
@ubqdqn Good answer, but I hope that this isn't our future :) –  eldo Jun 28 '14 at 19:33

You can use the Flatten[ ] function (first level) on both lists, and combine those results. More specifically,

coordsUS = Flatten[CountryData["UnitedStates", "Coordinates"], 1]


and

coordsCanada = Flatten[CountryData["Canada", "Coordinates"], 1]


are in the form that you are familiar with combining. For reference see Flatten.

-