Walkway Over the Hudson, April 2021
From the collection of the orthophotography posted on the first week of December.
From the collection of the orthophotography posted on the first week of December.
Yesterday, I posted a much more complicated piece of code that pulled addresses from the SAM (State Address Management) database and did a spatial join to add a column to the file with Assembly District and Municipality. This was a bit too complex, so I made a simpler one for other purposes that doesn’t require the coordinates to be obtained from SAM.
This python script takes two parameters:
Then the code will create a new CSV file with the spatially joined attributes pulled from the Shapefile. I have only run it on a few large data sets, but I found it took roughly 1 second to join 1,000 records from call to end of end of script.
#!/usr/bin/python
import requests,sys,json,os,csv
import pandas as pd
import geopandas as gpd
lines=[]
# read list of addresses from parameter 1
with open(sys.argv[-2], newline='') as csvfile:
for line in csv.DictReader(csvfile):
lines.append(line)
# convert to pandas
locPd = pd.DataFrame(lines,columns=lines[0].keys())
locPd.convert_dtypes()
locPd = gpd.GeoDataFrame(locPd, geometry=gpd.points_from_xy(locPd.x.astype('float32'), locPd.y.astype('float32')))
# run spatial joins against parameter 2
ad = gpd.read_file(sys.argv[-1])
locPd = gpd.sjoin(locPd, ad, op="within")
# remove added geometery and index columns
del locPd['geometry']
del locPd['index_right']
# write pandas back to out csv
locPd.to_csv (os.path.splitext(sys.argv[-2])[0]+'-output.csv', index = False, header=True)
While the automobile is long gone from this routing of Route 8, this wild turkey was strutting his way down the road. Didn't get a real good look at the turkey to see if it had a beard to determine if it was a tom or hen.
Saturday April 18, 2020 — East Branch Sacandaga River — Cod Pond Trailhead Camping Opporunities 🗺 — Eagle Pond Trail 🗺 — East Branch Gorge Trail 🗺 — East Branch Sacandaga River - NY 8 🗺 — Fox Lair Campsites 🗺— PDF with All Maps 📚