Announcement

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

  • Convert data - geodist error

    Hello,

    I am using the geodist command for my dataset which is composed on longitudes and latitudes.

    Code:
    clear
    input float(no lat1 long1)
      1 167 134
      2  19 133
      3 287 103
      4 205  22
      5 258  96
      6   3 138
      7 282 154
      8 180 273
      9 148 220
     10  96 104
    However, when I try to use the geodist command, I get the error that latitude should be between -90 and 90. Can someone explain how to convert my data to get around this? Thanks.

  • #2
    To suggest code to you we need to know what units you are using for latitude. We also need to know what units you are using for longitude. geodist didn't begin to start worrying about them; it bailed out given sight of your latitudes. If your data are just some arbitrary Cartesian coordinates, then geodist (SSC, as you are asked to explain) doesn't apply. As documented, it takes the Earth to be ellipsoidal, or spherical if you insist.

    Comment


    • #3
      Thanks for your reply. I was actually confused because my latitudes in the dataset are different than the ones that appeared in dataex. In the dataset, they're in terms of decimal degrees and all latitudes fall around 13. I am not sure why dataex is showing different values. Also, geodist works for many observations. However, for some observations, this error shows up.

      Comment


      • #4
        As an author of dataex, my bias is that it is right about what data you have; otherwise you need to explain what you mean.

        A wilder hypothesis is that you encoded string data, in which case your data are now pure garbage and you need to go back and start again.

        I still don't get what units you have. If your latitudes and longitudes are multiplied by 10 then your example latitudes vary between 0.3 and 28.7 and all are in Northern Hemisphere. Your longitudes are between 2.2 and 27.3 degrees and all are in the Eastern Hemisphere. Those are possible locations geographically but an unlikely study area statistically.

        That geodist appeared to work for many observations was probably an illusion. Probably all the data are wrong and so even the results that appear to work can't be trusted.

        This is undoubtedly soluble but you need to tell us much more. Telling us where the data come from and how you read them into Stata and what you did with them is almost certainly a good idea. Even simpler is to tell us where the places are supposed to be.

        Comment


        • #5
          Click image for larger version

Name:	Screen Shot 2018-10-22 at 6.25.26 PM.png
Views:	1
Size:	51.9 KB
ID:	1467001


          I'm sorry to use a screenshot but this is what the first ten latitude and longitude observations are like in my data. As you can see, the dataex observations are completely different. They are in decimal degrees.

          Comment


          • #6
            I asked several questions but most are unanswered. 13 N 79 E takes me to Tamil Nadu, India. Is that right?

            Comment


            • #7
              Yes.

              Comment


              • #8
                So, geodist should work for variables with latitude around 13 deg N and longitude around 79 deg E. Why your #1 shows completely different values is still unresolved. And it's still true that you may need to tell us more about your data.

                Comment


                • #9
                  So, I actually don't know how the latitudes and longitudes were entered but they have been used previously for other analysis. And no problems were encountered. Additionally, we used geonear and the same error didn't show up. Is there any other information that could be useful? Thank you for your help!

                  Comment


                  • #10
                    Most of the questions in #4 remain unanswered. Also, I don't think you gave a full example using dataex.

                    Comment


                    • #11
                      I am trying t find other info about the dataset. I was wondering if you can use the if command with geodist?

                      Comment

                      Working...
                      X