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

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

and Canadian data thus:

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:


I know how to combine lists of the following form:


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!



2 Answers 2


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

canus = {usa, 
    canada} = {CountryData["UnitedStates", "SchematicPolygon"], 
    CountryData["Canada", "SchematicPolygon"]};

enter image description here

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. enter image description here

  • $\begingroup$ @ubqdqn Good answer, but I hope that this isn't our future :) $\endgroup$
    – eldo
    Commented Jun 28, 2014 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]


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

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


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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