Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • spmap

    Hi, I would like to draw a map of Australia to show the population in each area. However, as you can see from the following graph, the area ACT is surrounded by the area NSW. Consequently, although the population in ACT is only 0.4 million, the area is still filled with dark blue color, the color for NSW (with a population of 8 million). Does anyone have any idea how I can fill the area of ACT with the correct color?
    Click image for larger version

Name:	Capture.JPG
Views:	1
Size:	75.6 KB
ID:	1748080

  • #2
    Jin Zhang

    The problem is that spmap does not know the ACT polygon is completely enclosed in another polygon. You need to add a variable called _EMBEDDED to the base map dataset. See the spmap help file "Spatial data format."

    For example:
    Code:
    copy https://www.abs.gov.au/statistics/standards/australian-statistical-geography-standard-asgs-edition-3/jul2021-jun2026/access-and-downloads/digital-boundary-files/STE_2021_AUST_SHP_GDA2020.zip aust.zip, replace
    unzipfile aust.zip, replace
    
    spshape2dta STE_2021_AUST_GDA2020, replace
    use  STE_2021_AUST_GDA2020_shp.dta
    gen  _EMBEDDED = 0
    replace  _EMBEDDED = 1 if _ID == 8
    save,replace
    
    
    use STE_2021_AUST_GDA2020.dta
    spmap AREA using STE_2021_AUST_GDA2020_shp.dta, id(_ID) clm(u) legend(off) fcolor(Rainbow)
    Click image for larger version

Name:	Graph.png
Views:	1
Size:	58.2 KB
ID:	1748199

    Comment


    • #3
      Thank you so much, Scott!

      Comment

      Working...
      X