>
> library(maptools)
>
> # A simple way to print out a list of coordinates for each polygon in your
> shapefile:
>
> # Path and filename of polygon shapefile
> testfile <- '/media/PKBACK# 001/FNR210/QGISLab/habitats/habitats.shp'
>
> # Read in polygon shapefile using handy maptools function
> test <- readShapePoly(testfile)
>
> # Extract the list of Polygons objects
> polys <- slot(test,"polygons")
>
> # Within each Polygons object
> #    Extract the Polygon list (assuming just one per Polygons)
> #    And Extract the coordinates from each Polygon
> for (i in 1:length(polys)) {
>    print(paste("Polygon #",i))
>    print(slot(slot(polys[[i]],"Polygons")[[1]],"coords"  ))
> }
>
>

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to