Announcement

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

  • Creating centroid of latitude and longitude over several observations by groups

    Hi,

    I am trying to create a centroid over a couple of observations by group_ID and my dataset looks like this:
    Code:
     
    latitude longitude group_ID
    -10.23 25.24 1
    15.34 67.45 2
    -67.45 32.34 2
    12.45 -87.12 2
    85.34 -34.53 1
    77.77 -23.34 2
    -56.78 56.78 1
    -89.44 34.34 2
    -23.45 67.89 1
    I have around 60k groups and 9 million observations. My final output should be a new variable (or two) which take on the values for the centroid for that given group. I tried using the centroid command but it did not work due to r(134) too many values. If it is possible to choose from different distance measures, I would prefer Euclidean distance. Any ideas on how I might be able to create that?

    Thanks!

  • #2
    See Robert Picard's post here.

    Comment

    Working...
    X