Announcement

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

  • How to create a full map of US with only metropolitan statistical areas(msa) with spmap function?

    Dear All

    I was trying to create a US map to show the population density, lets say, using a database which contains metropolitan or micropolitan areas. I got the database of shape file from the census beaureu which contained 929 areas. The shape file and the base map so associated only creates a portion of the map(only metro/micropolitans) and left of the US is left to be blank. I was wondering if there is a way by which i can show atleast the contours of the state so that the map looks complete. I used the following code:

    spmap pop using usmsacoord, id(id) clnumber(6) clmethod(eqint) fcolor(BuRd) ndfcolor(gs8) ndlab("Missing")

    Thanks
    Veeresh

  • #2
    Veeresh,

    I've never done this, but what you probably need to do is append your MSA shape file and a shape file that has the US state borders. You would just have to be careful that the MSA identifiers don't conflict with the state identifiers. See the Stata FAQ on spmap (http://www.stata.com/support/faqs/gr...pmap-and-maps/) for more details.

    Regards,
    Joe

    Comment


    • #3
      Joe

      Thanks for the response. I have not tried this way, though it looks quite tricky how stata will differentiate between metropolitan or micropolitan and state borders. It would be interesting to try the solution you proposed.

      Best
      Veeresh

      Comment


      • #4
        Veeresh,

        Although I think this might have worked, I see now that there is a better solution. There is a thing called a "background map" which is overlaid onto your map and for which you have no response data. It looks like the syntax is as follows:

        Code:
        spmap pop using usmsacoord, id(id) map(backgroundmap) clnumber(6) clmethod(eqint) fcolor(BuRd) ndfcolor(gs8) ndlab("Missing")
        So, you still need to find a US state shape file, as per my original response, but you can put that in the map() option instead of appending it to your MSA shape file.

        Regards,
        Joe

        Comment


        • #5
          Vereesh (or others),

          I am having the same issue - my data shows up properly across Urban Areas but I am unable to overlay the U.S. state boundaries. I have been trying to use the background map; I have US state shape files (as Joe mentions), but I receive an "invalid syntax" error when I try to use the map() option. The help guide is not clear to me, however; what file type/information should be used in the argument of map()? Any suggestions are much appreciated!

          Thanks,
          Justin

          Comment


          • #6
            For posterity's sake (and my apologies for spelling your name incorrectly, Veeresh), I was finally able to get it to work if I used polygon(data("filename.dta")) where the filename has the state coordinates from the underlying .shp file. The map() option still doesn't work for me, however.

            Comment


            • #7
              Justin and Vereesh,

              Upon further inspection, I see that the map() option only applies to cartograms. The syntax should be map("filename.dta") but unless you are doing a cartogram it's probably not what is wanted anyway. Using polygon() looks like a better alternative. Sorry for misleading you both.

              Regards,
              Joe

              Comment

              Working...
              X