2

I'm trying to create a heatmap of users' location in various world regions in R, but the dataset I'm working with contained a free text location field for users to fill on their own -- hence the quality of place names varies quite a bit. I'm OK with ignoring any string that won't parse as a known place (there's enough good data in here for me to get a sample), but I can't seem to find a failure-tolerant placename entity resolver to use in R.

Another issue is that some of these are cities and some of these are states and some of these are countries -- Ideally, I think, I'd like to make two maps, one map of the US in which all of the cities resolve to states, and one map of the world in which all of the locations on the first map resolve to the US. Is there a reasonably easy way of doing this?

Thanks!

serilain
  • 441
  • 4
  • 15
  • +1 ? failure-tolerant placename entity resolver ! F.T.P.E.R ! I don't understand but it sounds good :) – agstudy Dec 07 '12 at 00:21
  • [This](https://developers.google.com/maps/documentation/geocoding/) is worth a look, but depending on how you use it, it might not be free. – orizon Dec 07 '12 at 04:25
  • try geocode in package dismo which provides access to the google geocode engine and all its fallback logic, and the geonames package – mdsumner Dec 07 '12 at 04:45
  • thanks guys! will have a look tomorrow. – serilain Dec 07 '12 at 04:55
  • ok, geocode works beautifully provided I sample my data in order to not go over their 2500 daily API limit, but I'm having a very tough time making sense of how I'd go about turning the resulting list (USA, Spain, Spain, USA, UK, USA) into a geographic heatmap. I've never worked with counters in R before but I'm assuming that turning it into USA: 3, Spain: 2 and so on is trivial, but all of the shapefile examples I can find don't have a very transparent way of assigning values to entities. – serilain Dec 07 '12 at 22:22
  • nevermind; didn't know to just treat it like a plot. so far so good -- just need to figure out how to actually render it at the full dimensions of the screen and colour-code it attractively. – serilain Dec 07 '12 at 23:13

0 Answers0