Mapping

Which is Closer – New York or Texas?

Which is Closer - New York or Texas?

I've been playing with st_nearest_feature in R/sf to calculate nearest features on a map.

ct <- counties(cb=T, resolution = '20m') %>% st_transform(5070)
st <- states(cb=T, resolution = '20m') %>% filter(NAME %in% c('Texas','New York')) %>% st_transform(5070)

nr <- st_nearest_feature(ct, st)

ct <- cbind(ct, st_drop_geometry(st)[nr,])

Simple as Shit Geocoding with SAM

I like this PHP geocoding script I wrote to use with SAM, as it’s so simple, just six lines. Should I have used Python or Perl? Probably and it would have probably been 3 lines in Python or in case of Pathologically Eclectic Rubbish Lister probably one line. Basically you call this on command line with a text file list of addresses, and spits out a CSV file with the addresses followed by the coordinates from the NY State Address Management system. Most other states have something similar, as it’s kind of important that the fire truck and your Uber show up at the right house.

$output = "";		
foreach (file($argv[1]) as $address) {
	$json = file_get_contents('https://gisservices.its.ny.gov/arcgis/rest/services/Locators/Street_and_Address_Composite/GeocodeServer/findAddressCandidates?Street=&City=&State=&ZIP=&SingleLine='.urlencode($address).'&outFields=&maxLocations=1&matchOutOfRange=true&langCode=&locationType=&sourceCountry=&category=&location=&distance=&searchExtent=&outSR=4326&magicKey=&f=pjson');
	$coord = json_decode($json); 
	$output .= '"'.str_replace('"','\"', chop($address)).'",'.$coord->candidates[0]->location->y.','.$coord->candidates[0]->location->x."\n";
}
file_put_contents(pathinfo($argv[1], PATHINFO_FILENAME).'-geocoded.csv', $output);

State Forests with Pitch Pines 🌲🌲🌲🌲

Louise E. Keir WMA – Albany
Gas Springs State Forest – Allegany
Hanging Bog WMA – Allegany
Karr Valley Creek State Forest – Allegany
Phillips Creek State Forest – Allegany
Mccarthy Hill State Forest – Cattaraugus
Rock City State Forest – Cattaraugus
Frozen Ocean State Forest – Cayuga
Whalen Memorial State Forest – Chautauqua
New Michigan State Forest – Chenango
Perkins Pond State Forest – Chenango
Mariposa State Forest – Chenango-Madison
Macomb Reservation State Forest – Clinton
Livingston State Forest – Columbia
Taylor Valley State Forest – Cortland
Trout River State Forest – Franklin
Beartown State Forest – Lewis
Frank E. Jadwin State Forest – Lewis
Grant Powell Memorial State Forest – Lewis
Indian Pipe State Forest – Lewis
Sand Flats State Forest – Lewis
Charles E. Baker State Forest – Madison
Popple Pond State Forest – Oneida
Rome Sand Plains Unique Area – Oneida 1
Huckleberry Ridge State Forest – Orange
Roseboom State Forest – Otsego
Gates Hill State Forest – Schoharie
Petersburg State Forest – Schoharie
Sugar Hill State Forest – Schuyler
Brasher State Forest – St. Lawrence
Helmer Creek WMA – Steuben
Calverton Pine Barrens State Forest – Suffolk
David A. Sarnoff Preserve – Suffolk
Otis Pike Preserve – West – Suffolk
Rocky Point Pine Barrens State Forest – Suffolk
Bashakill WMA – Sullivan
Hickok Brook State Forest – Sullivan
Mongaup Valley WMA – Sullivan
Roosa Gap State Forest – Sullivan
Wolf Brook Multiple Use Area – Sullivan
Wurtsboro Ridge State Forest – Sullivan
Hammond Hill State Forest – Tompkins
Potato  Hill State Forest – Tompkins
Witch’s Hole State Forest – Ulster

Cattle in America (2017)

Cattle in America (2017)

The other day, I was looking at George Jenks' dot map of hogs in America on Facebook. 70 years ago in 1953, George Jenks wrote about and helped popularize the technique. It's fairly common these days, as it gives a good way to spot dense clusters of population.