[R-sig-Geo] Map layer
Paul Hiemstra
p.hiemstra at geo.uu.nl
Thu Aug 14 09:55:58 CEST 2008
Hi Fernando,
If you use the sp classes for spatial data you can use the spplot
function to make very nice plots. See
http://cran.r-project.org/doc/Rnews/Rnews_2005-2.pdf for more
information on sp. See
http://wiki.r-project.org/rwiki/doku.php?id=tips:spatial-data:import_export
for information on how to import your data into sp-classes.
In regard to your problem with the points outside the map. If your data
is stored in sp objects you can use the overlay() function from the
sp-package to determine which points are outside the polygon, see
?overlay for more details. Those points can be deleted from the
sp-object and they will not appear in the plot.
hth,
Paul
Fernando Miguez wrote:
> Hi all,
>
> I would like to be able to do the following
>
> map('state','illinois')
> points(x,y)
>
> Up to this point everything is fine. However, some of the points fall
> outside the Illinois map boundaries. What I would like to do is to add
> a layer where the inside of the Illinois polygon is transparent (so
> that the points can be seen) but the points outside the boundary are
> covered so they are not seen. I thought that using some variation of
> map with its arguments would work, but I haven't been able to figure
> it out. I see that it is quite possible that I'm using the wrong tools
> all together ... let me know.
>
> Any help is appreciated. Thanks.
>
> Fernando
>
--
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone: +31302535773
Fax: +31302531145
http://intamap.geo.uu.nl/~paul
More information about the R-sig-Geo
mailing list