[R-sig-Geo] how to filter a shapefile ?

Arnald Marcer arnald.marcer at uab.cat
Thu Sep 16 14:06:38 CEST 2010


Thank you Mayeul. Solved.

Arnald

On 09/16/2010 01:59 PM, Mayeul KAUFFMANN wrote:
> You can read your shapefile with:
> library(rgdal)
> countries_spdf<- readOGR(dsn=root_path, "countries_file_without_extension")
> #You'll have a spatial point data frame with marks. Look at str(countries_spdf).
> Try:
> plot(countries_spdf[countries_spdf at data$AREA>1000])
> Mayeul
> _____________________________________________________
> Dr. Mayeul KAUFFMANN, Conflict Specialist
> European Commission, Joint Research Centre (JRC)
> Institute for the Protection and Security of the Citizen (IPSC)
> Global Security and Crisis Management - ISFEREA
> Via E. Fermi 2749 - I-21027 Ispra (VA), ITALY
> Phone: (+39) 033278 5071
> http://isferea.jrc.ec.europa.eu/Staff/Pages/Kauffmann-Mayeul.aspx
>
> (Office: building 48c, 1st floor, room 123. TP: 483)
>
> _____________________________________________________
> Dr. Mayeul KAUFFMANN, Conflict Specialist
> European Commission, Joint Research Centre (JRC)
> Institute for the Protection and Security of the Citizen (IPSC)
> Global Security and Crisis Management - ISFEREA
> Via E. Fermi 2749 - I-21027 Ispra (VA), ITALY
> Phone: (+39) 033278 5071
> http://isferea.jrc.ec.europa.eu/Staff/Pages/Kauffmann-Mayeul.aspx
>
> (Office: building 48c, 1st floor, room 123. TP: 483)
>
>
> -----Original Message-----
> From: r-sig-geo-bounces at stat.math.ethz.ch
> [mailto:r-sig-geo-bounces at stat.math.ethz.ch] On Behalf Of Arnald Marcer
> Sent: Thursday, September 16, 2010 12:58 PM
> To: r-sig-geo
> Subject: [R-sig-Geo] how to filter a shapefile ?
>
> Hi,
>
> Can anyone give me a hint on how to extract/filter/subset
> polygons from a shapefile based on an attribute of its dbf
> table ?
>
> Example:
>
> shapefile: world.shp
> attributes of its dbf table: ID, AREA, COUNTRY, ...
>
> How can I plot a shapefile with only countries above a certain AREA value ?
>
> Thank you very much,
>
> Arnald Marcer
> CREAF
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>
>    


-- 
-----------------------------------------------------------------
Arnald Marcer
Investigador

Centre de Recerca Ecològica i Aplicacions Forestals (CREAF)
Universitat Autònoma de Barcelona
08193 Barcelona

Tel: 93 5811312
Fax: 93 5814151
-----------------------------------------------------------------
Arnald Marcer
Researcher

Centre for Ecological Research and Forestry Applications (CREAF)
Autonomous University of Barcelona
08193 Barcelona

Phone: +34 93 5811312
Fax:   +34 93 5814151



More information about the R-sig-Geo mailing list