0

I have Latitude and Longitude of a given point and I'd like to calculate the distance from this given point and some POIs (Point of Interest). Moreover I'd like to use OSM (OpenStreetMap) and R. Anyone can hel me?

Tnx

Nikolas
  • 2,066
  • 1
  • 19
  • 20
dag
  • 59
  • 1
  • 8
  • The `geosphere` package has all kinds of functions which can take lat/long arguments and return distance between points. There should be something in there which allows you to find what you are looking for. – Nick Criswell Feb 09 '17 at 15:41
  • Ok, but where I can find the POIs? Is there a list into some functions of the package? Tnx – dag Feb 09 '17 at 16:06
  • `ggmap` has a lot of functions which help you hook into Google APIs. From that, you might be able to use the Places or Maps API to get POI. – Nick Criswell Feb 09 '17 at 17:02

1 Answers1

1

Have you looked into using the osmar project (http://osmar.r-forge.r-project.org/) for accessing POI data from OpenStreetMap? Here is a tutorial for using it - https://journal.r-project.org/archive/2013-1/eugster-schlesinger.pdf.

So, osmar will allow you to access POI data via an API and then you can use any standard R package for handling spatial data to get distances.

Paul Crease
  • 150
  • 5
  • I 've already tried to use it but I didn't get results: require(osmar) src <- osmsource_api() bb <- center_bbox(41.875645, 12.481755, 1000, 1000) ua <- get_osm(bb, source = src) ua > ua osmar object 0 nodes, 0 ways, 0 relations any idea? – dag Feb 10 '17 at 14:02
  • Have you tried reversing the coords, e.g. center_bbox(12.481755, 41.875645, 1000, 1000). It looks like the coord order is lng/lat, in which case you would be querying an area of East Ethiopia, and I think you probably want Rome? – Paul Crease Feb 13 '17 at 10:39