Saturday 2014-01-25

When doing GIS work with GDAL ogr2ogr, and it creates a shapefile directory, the filenames indicate the type of shapefile.

ARC = Line String
CNT = Point
LAB = Point
PAL = Polygon

It's best to use rgdal's readOGR(). E.g. you grabbed a copy of the e00 for your local country, and ran ogr2ogr on it, and then got back a directory of shapefiles instead of a file. Counterintuitively, "shapes/sg-net.shp" is a directory.

readOGR(system.file("shapes/sg-net.shp", package="maptools")[1], layer="ARC") -> sg
ggplot( fortify(sg)) -> sg
sg + geom_path(aes(x=long,y=lat,group=group)) -> sg
sg + geom_point(data=ura.pe.dist, aes(x=long,y=lat, color=flor(pe,1)), alpha=0.7) -> sg
sg + coord_fixed() + scale_colour_gradientn(colours=rainbow(16))