GreenInfo-Network / Stanford-BOE2017

0 stars 0 forks source link

School to Retailer (Euclidean) Matrix and Long Form #8

Closed AmandaGIN closed 6 years ago

AmandaGIN commented 6 years ago

Next step after issue #7 Generate a table of retailers by store, within 1/2 mile buffer

Generate Near Table Input Features: P:\proj_p_s\Stanford_PRC\BOE_2017\data\Schools\CSCD_2016_publicSchools_K12 (poly) Near Features: P:\proj_p_s\Stanford_PRC\BOE_2017\data\BOE2017_2018_01_17 Output: P:\proj_p_s\Stanford_PRC\BOE_2017\data\Schools\SchoolsWithNearStores Search Radius: 0.5 miles Uncheck all 3 boxes (location, angel, find only closest feature) Maximum number of closest matches: default Method: PLANAR

AmandaGIN commented 6 years ago

In output table, code the starting place IN_FID back to the unique school code:

AmandaGIN commented 6 years ago

In output table, code the destination NEAR_FID back to the retailer license code:

AmandaGIN commented 6 years ago

I also brought in the DBA field and the 'closest school' field from the earlier analysis `NEARESTECU

!!!! ALERT !!!! This caused a mistake/error later - when the NEARESTECU was used for the distance to school - it should have instead used the NEAR_DIST converted from meters to miles.

AmandaGIN commented 6 years ago

Concate: rank, license, dba, miles

Bring CDS and concate results into Google Sheet https://drive.google.com/open?id=1DhQNnrRJf8RbqO4UETFIVOFD6c6vlwpxkFGdyW5czdA Use google sheet (unique, filter, pivot) to generate unique rows for schools with each corresponding retailer(s) in columns.

Downloaded to csv file and Renamed csv to txt P:\proj_p_s\Stanford_PRC\BOE_2017\data\Schools\GoogleSheet_SchoolsToStoreMatrix.txt

Imported in Excel (set CDS_Uniq to text and , deliminator)

Asking Nina if she wants all store attributes. If so, if she wants them in 1 cell or broken out (text to columns? try another .txt extension and then open again with a ; converter?)

AmandaGIN commented 6 years ago

Nina wants a flat file w/ one row for each retailer (the school repeats). Created file with both. P:\proj_p_s\Stanford_PRC\BOE_2017\data\Schools\Schools_to_Retailers_MalfMile.xlsx

AmandaGIN commented 6 years ago

Data Checks:

Final county in Excel: 69,171

The difference (13 more retailers in Excel file; less than 0.1%) is because the Generate Near Table method used is slightly more accurate than the spatial join test.

AmandaGIN commented 6 years ago

Nina wants all schools listed. If there are no retailers they are listed with a rank of 0.

AmandaGIN commented 6 years ago

Noted Near Table assigns same rank if the store is same distance - also included the total number and highlighted notes in metadata sheet.

AmandaGIN commented 6 years ago

Sent to client: P:\proj_p_s\Stanford_PRC\BOE_2017\data\Schools\Schools_to_Retailers_HalfMileEuclidean.xlsx https://www.dropbox.com/s/lh7elzi6kequ8lw/Schools_to_Retailers_HalfMileEuclidean.xlsx?dl=0

AmandaGIN commented 6 years ago

3/1/18 AR discovered and error in the data:

The miles reported in the initial file are incorrect. Column C on the sheet 'School to Retailers - Long Form' shows the miles TO THE NEAREST SCHOOL, that may, or may not be the school in column A. This error also affects the values of distance on the 'School to Retailer - Matrix' tab. That last of the four reported variables is incorrect (MILES). Again, it is the distance to the nearest school which may not be the school in column A.

Called and discussed with Nina and found it did not impact any of the uses of the file they have done to date.

Readme at: P:\proj_p_s\Stanford_PRC\BOE_2017\data\Schools\Distance_miles_error\aaaREAD_ME.txt

AmandaGIN commented 6 years ago

Run Generate Near to determine closest 1 (regardless of how far) P:\proj_p_s\Stanford_PRC\BOE_2017\data\Schools\Schools_Closest1store.dbf

In output table, code the starting place IN_FID back to the unique school code:

In output table, code the destination NEAR_FID back to the retailer license code:

Convert to miles MileClose = NEAR_DIST*0.000621371

AmandaGIN commented 6 years ago

Final workbook: P:\proj_p_s\Stanford_PRC\BOE_2017\data\Schools\Schools_to_Retailers_HalfMileNetworkAndEuclidean.xlsx Dropbox: https://www.dropbox.com/s/jmv7cuvu74guhcy/Schools_to_Retailers_HalfMileNetworkAndEuclidean.xlsx?dl=0