0
$\begingroup$

I have data of sold apartments. There is a street address for every apartment and I would like to generate a new variable that tells the distance from the train station. There are over thousand units in the data so I need figure out a efficient way to calculate the distance for each unit.

Sample of data:

City, Street address

Helsinki, Melkonkatu 21
Helsinki, Vaasankatu 7
Helsinki, Siilitie 6
Helsinki, Muukalaiskatu 2

And the address for train station is "Helsinki, Kaivokatu 1"

$\endgroup$
3
  • 2
    $\begingroup$ This is programming question rather than an statistics one, but Google Maps and other routing services can do this and they can be automated. Example: stackoverflow.com/questions/36775672/… $\endgroup$
    – Pere
    Commented Aug 14, 2017 at 9:56
  • $\begingroup$ Without a sample of your data it is really hard to give you any solid advice. Additionally, your question might be off-topic here as it seems you are asking how to calculate a distance based on certain fixed data. If I misunderstand however, and there is some estimation or the like required, it might be a 'statistics' question. Please elaborate. $\endgroup$
    – IWS
    Commented Aug 14, 2017 at 9:56
  • $\begingroup$ My goal is to create statistical model for aparment pricing and the distance from train station would be one of the predictors. $\endgroup$
    – ZeiH
    Commented Aug 14, 2017 at 10:21

1 Answer 1

1
$\begingroup$

Not necessarily efficient (though personally I don't consider thousands to be that high of a number data wise) but depending on the region you can download metadata to convert zip/post codes to lat/long coordinates.

For example if you are from the UK you can use: https://www.freemaptools.com/download-uk-postcode-lat-lng.htm

From here most pieces of software will have a library for calculating distances from lat/long coordinates for example in R you can use the geosphere package.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.