HumanitiesDataAnalysis / Directories

Exploratory code for NYC directory data
3 stars 0 forks source link

Strategy for creating streets #13

Open bmschmidt opened 2 years ago

bmschmidt commented 2 years ago

@Sppangu, @hpblood , and @bmschmidt talked through a strategy of:

  1. Filtering the historic streets file to just the street name, the geoid, and the number bounds (removing the geographical features.)
  2. Exploding each block to include every possible number (so that 10 - 20 Broadway becomes [10, 11, 12, 13, 14] Broadway as separate rows.
  3. Joining against that from the addresses file;
  4. Using the geoids there to rejoin against the Columbia streets database.
  5. Make pretty maps!

Although every point will the same at a first pass, this will make it possible down the line to locate each point exactly where it goes on the block, too.

bmschmidt commented 2 years ago

sketch of code:

streets |>
   mutate(number = list(lef_minimum:left_maximum)) |>
   unnest(number)
bmschmidt commented 2 years ago

Consider also using street_data |> st_centroid() to turn each block into a point.

Sppangu commented 2 years ago
stnumbered <- street_shapes |>
  select("OBJECTID","StreetModern", "y1880NameStreet", "y1880Left_Low", "y1880Left_High", "y1880Right_High", "y1880Right_Low") 

stnumbered <- stnumbered |>
  mutate(y1880Left_Low = as.numeric(y1880Left_Low)) |>
  mutate(y1880Left_High = as.numeric(y1880Left_High)) |>
  mutate(y1880Right_Low = as.numeric(y1880Right_Low)) |>
  mutate(y1880Right_High = as.numeric(y1880Right_High))

stnumbered <- stnumbered |>
  mutate(low = pmin(y1880Left_Low, y1880Right_Low, na.rm=TRUE)) |>
  mutate(high = pmax(y1880Left_High, y1880Right_High, na.rm = TRUE))|>
  head(10)
#Creating a pared down df that only has essential info 

streetsnumbered <- stnumbered |>
  select("y1880NameStreet", "low", "high", "OBJECTID")

streetsnumbered |>
  head(20)
attempt1 <- streetsnumbered |>
   mutate(numbers = list(low:high)) |>
  unnest(numbers) |>
  head(10)

#I'm getting a warning "Problem while computing numbers=list(low:high), numerical expression has 36788 elements: only the first used"