Announcement

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

  • Map integration: Distance from tube station?

    Is there a Stata package that can calculate the distance of an address from a category of landmarks?

    In particular, I am interested in calculating the distances of London addresses from tube and bus stations respectively.

    In the absence of Stata packages, any other suggestions on how I could get these data and incorporate into my massive dataset would also be highly appreciated. (my dataset has addresses broken down into multiple columns (e.g. street, postcode etc), but I could obviously merge into one column, if that helps at all)
    Thank you for your help!

    Stata SE/17.0, Windows 10 Enterprise

  • #2
    Hi Pratap,

    So you probably already have it, but if not, a list of the latitude / longitude coordinates for London tube stations can be found here
    A key question would be: have you already converted your existing addresses into latitude and longitude coordinates, or do you still need to do that?

    Many of the earlier Stata geo-distance commands that relied on the Google Map API or MapQuest API ceased to work when those companies changed their API's or terms of service.

    The 2016 Stata Journal article "osrmtime: Calculate Travel Time and Distance with OpenStreetMap Data Using the Open Source Routing Machine (OSRM)" discusses a number of current and prior methods for calculating geo-distances. Obviously, they explain how to use the community-contribute osrmtime.

    Another recent (2017) Stata Journal article, "A simple command to calculate travel distance and travel time" explains the community-contributed command georoute, which retrieves travel distance and travel time between two points defined either by their addresses or by their geographical coordinates.

    Other programs (mostly from SSC) that might be helpful are geodist, geonear, georoute, groupdist, and vincenty.

    Hope that helps!
    --David
    Last edited by David Benson; 24 Nov 2018, 20:58.

    Comment


    • #3
      Thanks, David! I do have https://wiki.openstreetmap.org/wiki/...round_stations, but honestly have no idea how to identify the closest station and calculate distance. Need I calculate distance to all and then min?
      Thank you for your help!

      Stata SE/17.0, Windows 10 Enterprise

      Comment


      • #4
        Hi Pratap, I'm not sure I'm going to be of much more help on this, since whenever I have needed to measure distances, I already had both sets of locations (i.e. where the startup was founded, where the startup is located now). So hopefully others can come along and chime in. You might check out the command groupdist above.

        So that you don't have to loop over every tube station every time, you might limit the loop to only search for stations within the same postal code or something.

        To help you get started, you might check out the following posts (neither are on Stata, but more on geocoding and finding nearest train stations).
        a) Geocoding and Finding Nearest Station with Google Web Services, link
        b) Showing nearest train stations from the property postcode, link
        Note that Google frequently changes its API, so those posts might be outdated.

        Comment


        • #5
          Look at Robert Picard's community-contributed command -geonear- (-ssc describe geonear-). Given file1 loaded into Stata, and an external Stata format file2 of lat/long locations, it will find the closest k locations in file2 relative to the locations in file1. -geonear- is *very* fast, easy to use, and well-documented.

          Comment

          Working...
          X