[R] masking a regular lat/lon grid to extract map boundaries

claudia tebaldi claudia.tebaldi at gmail.com
Wed Oct 8 00:08:32 CEST 2008


Dear R-helpers,

I have lat/lon coordinates of regularly spaced grid points, about 4Km
apart, covering the entire US continental region.
I would like to mask this rectangular grid in order to extract all and
only the grid points within a specific region.  Today I want to
extract Montana, say, from this grid, and I am hoping to somehow use
the returned value of the function map("state",region="montana").
I'm not espoused to using the "maps" library database, it's just the
way I thought one could go about it (one smarter than I am...) and it
would certainly be useful to exploit the many political boundaries
provided by that library, when I move on from Montana to something
else...

Any suggestion for an algorithm to do this?

Of course if someone out there has a high-res mask for the US states
I'll happily forget about using map(): I'll take it and interpolate
(or knn1) away to my grid!

thank you in advance

claudia

-- 
Claudia Tebaldi
Research Scientist, Climate Central
http://www.climatecentral.org



More information about the R-help mailing list