I want to generate 1000 random points within a specific ZIP Code Tabulation Area shapefile using pyshp. My code is:
import shapefile
zctashape = shapefile.Reader('C:/mypath/tl_2019_us_zcta510.shp')
shapefile_len = len(zctashape.shapes())
#identify the index for zcta 84049 and designate number of points.
zcta_to_use = '84049'
pointcount = 1000
for i in range(0,shapefile_len):
if zctashape.record(i)[1] == zcta_to_use:
record_i=i
break
record_i
How do I proceed from here? I apologize if this is basic, I am mostly an R user and it is very easy in that language. Shapefile downloaded from https://www.census.gov/cgi-bin/geo/shapefiles/index.php?year=2019&layergroup=ZIP+Code+Tabulation+Areas