Announcement

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

  • grmap without shapefile

    Dear Statalist members,

    Under the framework of spatial analysis, I have a dataset with coordinates of firms but without a related shapefile. I was trying to implement grmap but an error message comes up asking for a shapefile.

    Do you have any alternative suggestion?

    Thank you in advance.
    Maria

  • #2
    Download a shapefile separately for the area tat you are working on, making sure it uses the same coordinate system.

    Comment


    • #3
      I downloaded a shapefile and I get:

      HTML Code:
      . use "C:\...\set19.dta", clear
      
      . spset _ID, modify replace
        (_shp.dta file saved)
        (data in memory saved)
        Sp dataset set19.dta
                      data:  cross sectional
           spatial-unit id:  _ID
               coordinates:  _CX, _CY (planar)
          linked shapefile:  set19_shp.dta

      But then, having coordinates of firms how to combine with that since _CX and _CY were already created before?

      If preferable, I can add both files.

      Thanks

      Comment


      • #4
        The idea of this exercise is that you would create one layer, that draws the boundaries of your country or state, and then add a layer on top that places the location of the firms.
        You can do this with the point() option in spmap: http://fmwww.bc.edu/repec/bocode/s/spmap.html
        And see an example of a comparable task here: https://www.statalist.org/forums/for...ers-with-spmap

        This is assuming you want to pinpoint location of individual firms.
        If you want the e.g., the total number or concentration of firms in individual states or counties in your map, the answer is a little different.

        If you want more specific help:
        - tell us what info the map should present
        - Provide a data example of your firm dataset with coordinates etc
        - Share a link to he same shapefile you downloaded

        Comment


        • #5
          Thank you for your valuable comments.

          In fact, I would like first to pinpoint location of individual firms, and on a second map the concentration of a certain variable.

          I tried to follow the steps that you suggested, but I only obtain a red point in the center on top of municipalities for the first goal:

          Code:
          spmap ln_Expendit using "P_c3", id(_ID) legend(size(medium) position(11)) fcolor(Blues) title("ln expend") subtitle("2014") note("Source: ACSS")  point(data("coordinates.dta") xcoord(C_X_lon) ycoord(C_Y_lat) fcolor(red) ocolor(white) size(*3))

          For the second case, the variable does not even show up:
          HTML Code:
          spmap ln_Expendit using "P_c3", id(_ID) legend(size(medium) position(11)) fcolor(Blues) title("ln expend") subtitle("2014") note("Source: ACSS")  point(data("coordinates.dta") xcoord(C_X_lon) ycoord(C_Y_lat) proportional(ln_Expendit) fcolor(red) ocolor(white) size(*3))
          Appearing the message:
          Problem with option point(): variable ln_Expendit specified in suboption proportional() not found
          Thank you

          Comment


          • #6
            Additional note:
            I tried to attach the corresponding datasets through the option Upload Attachments, but an error message pops up: "This is not a valid image file. P_d3.dta"

            Comment


            • #7
              I'm finding this very abstract to comment on without a data example. And I understand this is more difficult to provide with these larger datasets.

              Perhaps the following tutorial with examples is explanation enough so that you can adjust for your own data and results?
              https://www.stata.com/meeting/italy1...t14_pisati.pdf

              All I can say unfortunately is that I've seen your code and agree that it seems correct syntax, so there might be a problem with the sort of data you are feeding spmap and what it is expecting to be fed. Again, try with the example datasets and analysis in the above presentation, and see if you can figure anything out.

              Comment

              Working...
              X