Announcement

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

  • Create polygon using coordinates

    Does stata have the capability to help create a shape file by filling in the lines between coordinates that will form polygons I am trying to map? For instance, I have four points (lat, lon) per id, I want to connect those points to form a polygon, the output will be a shape file I can use to create maps.

    I know I can do this using other software, ie ArcGis, but I prefer to use Stata if possible.

    thanks
    Donovan

  • #2
    Yes, though the last the last pair coordinates must be equal to the first pair for each polygon:
    Code:
    clear
    input double x y
    10 15
    10 20
    20 20
    20 18
    14 18
    14 17
    20 17
    20 15
    10 15
    . .
    22 22
    22 28
    28 28
    28 22
    22 22
    end
    line y x, cmissing(n)
    You should take a look at spmap (-ssc desc spmap-) and in particular the discussion on "spatial data format".
    Also the Stata FAQ is helpful: https://www.stata.com/support/faqs/g...aps/index.html

    Comment

    Working...
    X