[R-sig-Geo] Iterating and finding points in a spatial polygon
Jim Burke
j.burke at earthlink.net
Tue Apr 28 05:14:31 CEST 2009
Thanks in advance. All insight is appreciated. R is great!
HELP NEEDED DESCRIPTION
==============================
A. Matching the "lappt" to the spatial polygon. To correctly retrieve
the "labpt" to use
in method ptp().
Working from the example found below. There might be a better way.
http://nceas.ucsb.edu/scicomp/GISSeminar/UseCases/PointInPolygonAnalysis/point_in_poly.html
B. Iteration through the two spatial polygons.
POLYGON DESCRIPTION, ITERATION, OUTPUT
==============================
1. blk_sp contains many spatial polygons that fit entirely
into different pct_big_sp spatial polygons. No
overlapping exists.
Yes these are US census blocks
2. pct_big_sp contains around thirty different blk_sp
spatial polygons.
Yes these are precincts that contain the census blocks.
3. How this might work.
a. iterate through every pct_big_sp, then blk_sp
b. compares the blk_sp "labpt" (lat long format) to the
outside edge of the larger polygon b_big_sp. Probably
with pip().
c. output the matching blk_sp IDs into an match_df data
frame. On a match, gather the following items as we
iterate.
. blk_sp's ID name BLK
. pct_big_sp's ID name PCT
d. c_df output data frame example.
BLK PCT
"480019510006079",1811
"480019510006080",1811
"480019510006998",1811
"480019510006999",1811
"480039501003000",1120
"480039501003001",1120
"480039501003002",1120
"480039501003003",1120
Thanks,
Jim Burke
More information about the R-sig-Geo
mailing list