[R-sig-Geo] Problem clipping SpatialPolygonDataFrame

Luciano La Sala lucianolasala at yahoo.com.ar
Thu Apr 23 16:36:35 CEST 2015


Hello everyone,

I have a SpatialPolygonsDataFrame for Argentina which I need to crop 
using a bounding box or any other method. I tried the following but the 
new map turns out to have the same exact extent as the original one:

# Info on my Data Frame.

 > summary(arg.provinces)
Object of class SpatialPolygonsDataFrame
Coordinates:
         min       max
x -73.57778 -53.59183
y -55.06153 -21.77855
Is projected: FALSE
proj4string :
[+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0]

 > extent(arg.provinces)
class       : Extent
xmin        : -73.57778
xmax        : -53.59183
ymin        : -55.06153
ymax        : -21.77855

# Trying to clip it

out <- crop(arg.provinces, extent(-73.57778, -53.59183, -55.06153, 
-21.77855))
plot(out)

 > extent(out)
class       : Extent
xmin        : -73.57778
xmax        : -53.59184
ymin        : -55.06153
ymax        : -21.77855


Thank you very much in advance!


-- 
Luciano F. La Sala
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
Cátedra de Epidemiología
Departamento de Biología, Bioquímica y Farmacia
Universidad Nacional del Sur
San Juan 670
Bahía Blanca (8000)
Argentina



More information about the R-sig-Geo mailing list