Group Abstract Group Abstract

Message Boards Message Boards

Creating a Map of Sierra Leone

Posted 11 years ago
POSTED BY: John Pearson
6 Replies
Posted 11 years ago

It's improving and I appreciate the effort. BUt it isn't quite there yet. What I really need is for GeoRegionValuePlot to work on these places. I think it fails because if you run, say, AdministrativeDivisionData[Flatten[prefectures] , "Position"] the output is:

{Missing["NotApplicable"], Missing["NotApplicable"], 
 Missing["NotApplicable"], Missing["NotApplicable"], 
 Missing["NotApplicable"], Missing["NotApplicable"], 
 Missing["NotApplicable"], Missing["NotApplicable"], 
 Missing["NotApplicable"], Missing["NotApplicable"], 
 Missing["NotApplicable"], Missing["NotApplicable"], 
 Missing["NotApplicable"], Missing["NotApplicable"], 
 Missing["NotApplicable"], Missing["NotApplicable"], 
 Missing["NotApplicable"], Missing["NotApplicable"], 
 Missing["NotApplicable"], Missing["NotApplicable"], 
 Missing["NotApplicable"], Missing["NotApplicable"], 
 Missing["NotApplicable"], Missing["NotApplicable"], 
 Missing["NotApplicable"], Missing["NotApplicable"], 
 Missing["NotApplicable"], Missing["NotApplicable"], 
 Missing["NotApplicable"], Missing["NotApplicable"], 
 Missing["NotApplicable"], Missing["NotApplicable"], 
 Missing["NotApplicable"], Missing["NotApplicable"]}

You can try to run the following code and you'll see that the map it produces doesn't color any of Guinea nor the districts in Sierra Leone that are in the Southern District.

provinces = CountryData["SierraLeone", "AdministrativeDivisions"];
districts =   AdministrativeDivisionData[#, "Subdivisions"] & /@ provinces;
districts = Flatten[districts];
regions = CountryData["Guinea", "AdministrativeDivisions"];
prefectures =   AdministrativeDivisionData[#, "Subdivisions"] & /@ regions;
counties = CountryData["Liberia", "AdministrativeDivisions"];
alladmindistricts = Flatten[Join[prefectures, districts, counties]];
Print["Length[alladmindistricts]=", Length[alladmindistricts]];
rints = RandomInteger[100, 63];
GeoGraphics[ MapIndexed[{EdgeForm[Black], FaceForm[ColorData[1][#2[[1]]]], Polygon[#]} &, alladmindistricts]]
GeoRegionValuePlot[Thread[alladmindistricts -> Log10[rints]], 
 ColorFunction -> ColorData["Rainbow"], 
 GeoBackground -> GeoStyling["StreetMap"], ImageSize -> 700]
POSTED BY: John Pearson
Posted 11 years ago

I see that I have made an error in the above code. In the following you can see that The corrected code also fails to return positions of the Prefectures in Guinea.

regions = CountryData["Guinea", "AdministrativeDivisions"]
prefectures = Flatten[AdministrativeDivisionData[#, "Subdivisions"] & /@ regions];
(*This next one fails *)
 positions    =  AdministrativeDivisionData[#, "Position"] & /@ prefectures
 guineagons  =  AdministrativeDivisionData[#, "Polygon"] & /@ prefectures;
    (* This plots all of the prefectures of Guinea *)
 GeoGraphics[{EdgeForm[Black], FaceForm[Red], guineagons}]
 provinces = CountryData["SierraLeone", "AdministrativeDivisions"];
 districts =  AdministrativeDivisionData[#, "Subdivisions"] & /@ provinces;
 districts = Flatten[districts];
 lendist = Length[districts];
 rints = RandomInteger[10, lendist];
  (*  this plots some, but not all of the districts of Sierra Leone *)

  GeoRegionValuePlot[Thread[districts -> Log[rints]]]
   lenp = Length[prefectures];
   rints = RandomInteger[10, lenp];
  (* This doesn't plot any of the prefectures of Guinea *)
  GeoRegionValuePlot[Thread[prefectures -> Log[rints]]]
POSTED BY: John Pearson
Posted 11 years ago

I guess this is a cleaner way to demonstrate the difficulties. It solves the troubles I was having with SemanticInterpretations but not the problem with the maps.

For Sierra Leone:

provinces = CountryData["SierraLeone", "AdministrativeDivisions"]
districts =  AdministrativeDivisionData[#, "Subdivisions"] & /@ provinces;
GeoGraphics[{EdgeForm[Black], FaceForm[Red],     Polygon[#]}] & /@ districts

and Guinea below. As you can see it fails entirely on all the prefectures of Guinea. I did the same thing on the US (states and counties and it failed on Alasksa but I think all the other states worked.

regions = CountryData["Guinea", "AdministrativeDivisions"]
prefectures =  AdministrativeDivisionData[#, "Subdivisions"] & /@ regions
GeoGraphics[{EdgeForm[Black], FaceForm[Red], Polygon[#]}] & /@ prefectures
POSTED BY: John Pearson

Give it a try now, Wolfram|Alpha has updated its data and now your examples work as expected:

regions = CountryData["Guinea", "AdministrativeDivisions"]
prefectures = AdministrativeDivisionData[#, "Subdivisions"] & /@ regions

GeoGraphics[
 MapIndexed[{EdgeForm[Black], FaceForm[ColorData[1][#2[[1]]]], 
    Polygon[#]} &, prefectures]]

Guinea

And also for Sierra Leone:

provinces = CountryData["SierraLeone", "AdministrativeDivisions"]
districts =  AdministrativeDivisionData[#, "Subdivisions"] & /@ provinces;

GeoGraphics[
 MapIndexed[{EdgeForm[Black], FaceForm[ColorData[1][#2[[1]]]], 
    Polygon[#]} &, prefectures]]

Sierra Leone

Thank you for reporting this issue. Our developers team is looking into it.

POSTED BY: EDITORIAL BOARD
Posted 11 years ago

You might have them look at Guinea while they're at it. It seems to get worse. Guinea is similar in that it is chopped into 7 "regions" which the following does fine on: GeoListPlot[CountryData["Guinea", "AdministrativeDivisions"]]

. However the entire country has 33 prefectures which I am unable to plot. You can try this:

pnames = {"Conakry Prefecture", "Gaoual Prefecture", "Gueckedou Prefecture", "Macenta Prefecture", "Dabola Prefecture",  "Kissidougou Prefecture", "Dinguiraye Prefecture", "Telimele Prefecture", "Boffa Prefecture", "Kouroussa Prefecture",  "Siguiri Prefecture", "Pita Prefecture", "Nzerekore Prefecture", "Yomou Prefecture", "Dubreka Prefecture", "Forecariah Prefecture", "Kerouane Prefecture", "Coyah Prefecture", "Dalaba Prefecture", "Beyla Prefecture", "Koubia Prefecture", "Kindia Prefecture", "Lelouma Prefecture", "Lola Prefecture", "Boke Prefecture", "Mali Prefecture", "Mamou Prefecture", "Mandiana Prefecture",   "Faranah Prefecture", "Kankan Prefecture", "Fria Prefecture", "Labe Prefecture", "Koundara Prefecture"}

Prefectures = SemanticInterpretation /@ pnames

GeoListPlot[Prefectures] fails. (edit: GeoListPlot[pnames] -> GeoListPlot[Prefectures]

POSTED BY: John Pearson
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard