[R-sig-Geo] Iterating and finding points in a spatial polygon - VERSION 2 Ignore earlier send!

Jim Burke j.burke at earthlink.net
Tue Apr 28 08:04:58 CEST 2009


This is version 2. Clearer description. Ignore the earlier one.

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 Slot "labpt" to use
  in method ptp(). Slot "labpt" and measurements are all in WSG84 long 
lat (see below).

  Slot "labpt":
  [1] -96.75983  32.93319

  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 all polygons in each of the two spatial polygon 
data frames.

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 Slot "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