I'm new to GIS and R-- hope this question makes sense.

I have a dataframe(geo07) containing two variables that record the long/lat values for about 6000 points (mat_long & mat_lat). These points correspond to all health centers of a certain type in the US. I can plot the points on a US by:

map("worldHires","usa", xlim=c(-125,-60),ylim=c(25,52), col="gray95", fill=TRUE)
points(x=geo07$mat_lon,y=geo07$mat_lat,pch=19, col="red", cex=0.5) 

But what I really want is to color the entire US map based on distance to the closest health center. Conceptually, I need to break the US into points/small areas and color them based on their distance to the nearest health center. Is this a heatmap? Are their R functions to do this?

  • Would counties be small enough for your small areas to carry the message? – mdsumner Oct 14 '14 at 19:20
  • Looks like Voronoi diagrams on the map. – user17665 Oct 14 '14 at 20:03
  • @m0nhawk: I don't think so. A Voronoi diagram shows "which health centre is closest to this point", not "how far is this point from any health centre". It would look more like a heatmap. – Steve Bennett Oct 14 '14 at 21:07

There is a distmap() function in spatstat package that creates a pixel image of the distance to the points. At the provided link you will find a great tutorial for this package (including distmap() example).

  • This looks VERY promising--- thanks! I'll followup to let you know how it works. Much appreciated! – jbk Oct 15 '14 at 14:07
  • @jbk, did you manage to get what you want with distmap()? If yes - consider accepting my answer (check grey mark under votes for the answer) to remove it from "unanswered" section. If no - modify your question accordingly to your issues with distmap(). – SS_Rebelious Oct 21 '14 at 14:44
  • So sorry--- I've had to put this problem on the back burner. I've only now gotten back. – jbk Oct 22 '14 at 20:55
  • So sorry--- I've had to put this problem on the back burner. I've only now gotten back. But, I think distmat will work. So Thanks! – jbk Oct 22 '14 at 21:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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