Skip to contents

Takes 3 seconds to find state for 1k points, so a faster alternative would be useful It can take approx. one minute for 2.5 million points as in state_from_latlon(frs$lat, frs$lon)

Usage

state_from_latlon(lat, lon)

Arguments

lat

latitudes vector

lon

longitudes vector

Value

Returns data.frame: ST, statename, FIPS.ST, REGION, n as many rows as elements in lat or lon

Examples

 myprogram <- "CAMDBS" # 739 sites
 pts <- frs_from_program(myprogram)[ , .(lat, lon, REGISTRY_ID,  PRIMARY_NAME)]
 # add a column with State abbreviation
 pts[, ST := state_from_latlon(lat=lat, lon = lon)$ST]
 #map these points
 mapfast(pts[ST == 'TX',], radius = 1) # 1 miles radius circles