Announcement

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

  • creating a Map with STATA

    Hi,
    Am trying to follow up the steps of creating maps with STATA on Youtube and fail.
    Can somebody assist me with an easy code of creating and labelling maps with stata?
    thx

  • #2
    Welcome to the Stata Forum / Statalist.

    You may start by typing:

    Code:
    . help sp
    Then, you may wish to take a look at Intro 7, aptly named "Example from start to finish".

    Hopefully that helps.
    Best regards,

    Marcos

    Comment


    • #3
      What sort of maps are you interested in making? Maptile (by the illustrious Michael Stepner) is a wonderful wrapper for spmap that makes it very easy to map variables by for a few selected geographies, mostly within the United States. Maptile also includes instructions for turning arbitrary shapefiles describing regions into geographies that are compatible with Maptile. I'd start there.

      Comment


      • #4
        I learned to draw maps looking at this post:

        https://www.stata.com/support/faqs/g...pmap-and-maps/

        Of course, if you have Stata 15, the command grmap should work for you. Nonetheless, since it has been developed starting from spmap, the command revised in link above, it is better to start reading the latter.

        Comment


        • #5
          I am trying to create a map with those instructions. I downloaded "international map without boundary lakes from here," (http://www.naturalearthdata.com/down...0-countries-2/) unzipped it and saved it locally. But when I try to use the shp2dta command, I am informed that there is an invalid shape file. Specifically, I am typing:
          • shp2dta using Y:\Ian\ne_110m_admin_0_countries_lakes.cpg, data(worlddata) coor(worldcoor) genid(id)
          and then receiving
          • type: .
          • Y:\Ian\ne_110m_admin_0_countries_lakes.cpg: invalid shape file
          • r(610);

          Comment


          • #6
            You should not use that file extension. Try:

            Code:
            shp2dta using ne_110m_admin_0_countries_lakes, data(worlddata) coor(worldcoor) genid(id)

            Comment


            • #7
              Unfortunately, that doesn't work either.

              . shp2dta using ne_110m_admin_0_countries_lakes, data(worlddata) coor(worldcoor) genid(id)
              file ne_110m_admin_0_countries_lakes.shp not found
              r(601);

              Comment


              • #8
                Well you can't possibly have downloaded the shapefile you claim from the link in #5 because that points to a 50m shapefile. The shapefile I used was found on the following page:
                Code:
                http://www.naturalearthdata.com/downloads/110m-cultural-vectors/
                and by clicking on the "download without boundary lakes" link in the top subsection titled "Admin 0 - Countries". I unzipped the zip archive and copied all the files to Stata's current directory. I then issued the same command as you did and got no error.
                Code:
                . shp2dta using ne_110m_admin_0_countries_lakes, data(worlddata) coor(worldcoor) genid(id)
                type: 5
                
                .
                Perhaps you do not realize that a shapefile is a collection of files. They all need to be present for shp2dta to do its thing (not quite accurate, you need the file with an ".shp" extension and another file with the ".dbf" extension.

                Comment

                Working...
                X