Announcement

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

  • Calculating distance between one dataset with xy coordinates and one with lat/long

    Hi all,

    I have two datasets, one with 100.000 locations in xy coordinates. And one with 15 locations is both xy and lat/long.
    Now I want to calculate in the big dataset the nearest distance to one of the 15 locations. Normally you would use -geonear- for this. But since the big dataset is in xy coordinates, this is not possible. Does anyone know how I can solve this?

    Thanks in advance!!

  • #2
    Hello Veronique,

    I also have 2 datasets with locations in xy coordinates and lat/long. I would like to calculate distance to the nearest main road in each location.

    Do you mind sharing how you dealt with your issue?

    PS. My datafiles have at least 15,000 values.


    Thank you.

    Comment


    • #3
      Hello Veronique and Anne,

      I have a dataset with XY coordinates and would like to calculate the distance between two points in the data set. Thus request you to share what you have found while you were dealing with your issue,

      Ideally, I would like to convert XY coordinates to lat-long before calculating. Request you to help me with the same, if you can.

      Thank you!

      Comment


      • #4
        Rohin,

        1) Stata's geo2xy command (SSC install geo2xy) can convert from latitude/longitude to x,y but I don't think it can do the opposite. See here and here for Statalist comments asking something similar. Although stackoverflow and stackexchange offer some alternate means of doing so (not using Stata). (See here and here).

        2) Once you have lat/long, you can use Stata's geodist and geonear commands (both from SSC) for calculating the distance between points. See examples here, here, here, and here.


        Comment


        • #5
          Thank you, David. These are helpful.

          Comment

          Working...
          X