Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

package for geocoding (street location!) and next calculation of distance

EDIT: And package for not geographical distance between two lan-long points, but distance by car, or foot (like this http://code.google.com/intl/sk/apis/maps/documentation/directions/) Travel mode - driving, walking. No map, just distance. Thanks for any idea.


Hello. I search package in R, what gives me longtitude and latitude for data frame with 10000 locations like this "STREET, town, Europe".

And then package, what gives me distance per haversine formula for those locations. But mainly package for lat-long.. Distance should be easy.

I searched a lot but found nothing useful for me. Thanks for help! I hope that R knows it :)

like image 379
parenthesis Avatar asked Feb 17 '11 16:02

parenthesis


2 Answers

Package dismo has address level geocode(), though installation can be difficult on some platforms.

Package sp has WGS84 ellipsoidal distance in spDistsN1().

like image 111
mdsumner Avatar answered Oct 19 '22 18:10

mdsumner


Getting street locations is going to need google's help or similar. Or possibly OpenStreetMap, but I'm not sure what the API is:

http://nominatim.openstreetmap.org/

For just cities, search the geonames database for populated places using my geonames package:

>library(geonames)

> GNsearch(q="Toronto",fcode="PPLA")
  countryName adminCode1           fclName countryCode      lng
1      Canada         08 city, village,...          CA -79.4163
                                      fcodeName toponymName fcl    name fcode
1 seat of a first-order administrative division     Toronto   P Toronto  PPLA
  geonameId      lat adminName1 population
1   6167865 43.70011    Ontario    4612191
like image 2
Spacedman Avatar answered Oct 19 '22 17:10

Spacedman