On Mon, 16 Feb 2009, Jim Burke wrote:

(Just stick to plain text, but don't use fonts or bold or stuff - keep it simple).

I have a nice solid SpatialPologonsDataFrame and a new line file (wkbLineString) called "major roads.shp".

MY QUESTIONS.

*I would appreciate examples of*

*a)How to merge the intersection of a **SpatialPologonsDataFrame and a wkbLineString **


Why, and what do you mean? You have some 30000 road lines, what do you want to know? How much of which road is in which polygon? Again, you need to think through your workflow. My inclination would be to rasterise the lines in a GIS, and overlay the raster cell centre points on the polygons, but maybe you want line length, or to retain the line IDs (all 30000 of them).


b)How to plot the result

You can of course overplot lines on polygons, with add=TRUE in plot() methods and sp.layout= in spplot() methods. But plotting the result of the "intersection" means what?

c)How to display the street name on the plot (that's FNAME from the major roads.dbf file).

30000 names? Do you have a very large screen? Lines objects have IDs, but no label point, so there is no easy way of doing it, even label alignment is hard.

I can't actually see the statistical question here, could you please make it clearer?

Do you simply want to plot a subset of the road lines on your solid polygons, adding names? Then you need to find out how to subset them, perhaps by cookie-cutting using the union of your polygons, add label points and rotation angles (probably by hand), and off you go, but these are essentially GIS operations.

Roger

*


ADDITIONAL INFORMATION.

The SpatialPologonsDataFrame is a garden variety collection of geographical polygons.
tx1_sp <- readShapePoly("precinct08.shp", IDvar="PCT",
proj4string=CRS("+proj=aea +ellps=GRS80 +datum=WGS84"))



The new file to intersect merge is major roads line map that should overlay part of my SpatialPolygons. It does not behave like a Shapfile.

main_roads <-readOGR("main roads.shp", layer = "main roads")
OGR data source with driver: ESRI Shapefile
Source: "main roads.shp", layer: "main roads"
with  29161  rows and  33  columns
Feature type: wkbLineString with 2 dimensions


Thanks,
Jim Burke

_______________________________________________
R-sig-Geo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: [email protected]

_______________________________________________
R-sig-Geo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to