[R-sig-Geo] One-to-many table relationship to shapefile polygon in spplot / plot - possible?
Noli Sicad
nsicad at gmail.com
Wed Jan 6 11:05:57 CET 2010
> Depends on your GIS! Shapefiles only have a 1-1 relationship, but
> that's because they are a bit rubbish. If you use a proper spatial
> database then you can do one-many. This is an application for a
> PostGIS or Spatialite database, and if your GIS can read that (Qgis
> for example) then you are sorted.
I want to do it in R. R can do quick and pretty graphs and maps!
>> The result data I am trying to map using spplot has 1 to 70 years
>> periods. I want to produce maps per period, for 10 years or more for
>> forest management regimes in forest stand.
>
> I wouldn't reshape the data in R to create a possibly sparse matrix,
> and then have to code in column names with expressions (e.g.
> data[,paste("Year",y,sep="")], which I think is icky). I would just
> create a spatial polygons/points data set with just an ID column, and
> put your ID/Period/Age data in a non-spatial data frame. Then when you
> want to plot a particular thing, just match up the data with the
> spatial data and plot (using the 'match' function).
This is what actually I wanted!
"column names with expressions (e.g. data[,paste("Year",y,sep="")]" in
shapefile database?
Yes, created Crop_ID which is supposed to be Polygon ID in my
foreststand.dbf. I have also Crop_ID, Period, Age in non spatial table
i.e. harvest.dbf
This is the harvest.dbf
names(harvest.dat) = c("CROP_ID", "CROPTYPE",
"Period","Ini_Age","Cut_Age", "Area_Cut")
Barry, any snippet how to use match in spplot or plot.
Thanks. Noli
More information about the R-sig-Geo
mailing list