I have a R data.frame containing longitude, latitude which spans over the entire USA map. When X number of entries are all within a small geographic region of say a few degrees longitude & a few degrees latitude, I want to be able to detect this and then have my program then return the coordinates for the geographic bounding box. Is there a Python or R CRAN package that already does this? If not, how would I go about ascertaining this information?
I have a R data.frame containing longitude, latitude which spans over the entire USA
Share
I was able to combine Joran’s answer along with Dan H’s comment. This is an example ouput:

The python code emits functions for R: map() and rect(). This USA example map was created with:
and then you can apply the rect()’s accordingly from with in the R GUI interpreter (see below).
Here is an example TSV file (site.tsv)
With my data set, the output of my python script, shown on the USA map. I changed the colors for clarity.
Addition on 2013-05-01 for Yacob
These 2 lines give you the over all goal…
If you want to narrow in on a portion of a map, you can use
ylimandxlimYou will want to use the ‘world’ map…
It has been a long time since I have used this python code I have posted below so I will try my best to help you.
Here is a complete example. The TSV file is located on pastebin.com. I have also included an image generated from R that contains the output of all of the rect() commands.