Stewart’s 📍

🗺️ Maps 🖼️ Photos 📽️ Videos

Largest Earthquakes to Hit NY State

Largest Earthquakes to Hit New York State
Year Location Magnitude County Town
1944 8 km S of Cornwall, Canada 5.74 St. Lawrence Massena town
2002 8 km NNW of Au Sable Forks, New York 5.30 Clinton Black Brook town
1983 8 km WSW of Newcomb, New York 5.10 Essex Minerva town
1877 Adirondack region, New York 4.90 Franklin Franklin town
1897 Lake Champlain area, New York 4.70 Clinton Au Sable town
1929 5 km S of Corfu, New York 4.70 Genesee Darien town
1931 2 km SSW of Warrensburg, New York 4.70 Warren Warrensburg town
1944 6 km ESE of Cornwall, Canada 4.50 Franklin St. Regis Mohawk Reservation
1934 6 km WSW of Dannemora, New York 4.50 Clinton Saranac town
1853 Near Lowville, New York 4.50 Lewis Martinsburg town
1848 Near Tarrytown, New York 4.35 Westchester Mount Pleasant town
1857 Niagara County, New York 4.30 Niagara Royalton town
1867 East of Ogdensburg, New York 4.30 St. Lawrence Lisbon town
1966 3 km SE of Attica, New York 4.27 Wyoming Attica town
1975 6 km E of Altona, New York 4.20 Clinton Altona town
1928 7 km NNW of Paul Smiths, New York 4.10 Franklin Brighton town
1916 3 km SE of Galway, New York 4.10 Saratoga Galway town
Andy Arthur, 3/10/23.
Data Source: USGS Earthquakes. earthquake.usgs.gov/earthquakes/search/
Map: Severence Hill Trail
Map: Gilman Lake

Stock Market Deals!

Why do people get excited about lower prices at stores on Black Friday but not about cheaper prices on stock market? Cheaper prices means you get more shares for less money. What’s not to like?

Map: Empire State Topography
Thematic Map: 2.5 million New Yorkers live within a half mile of a landfill

Fast Reverse Geocoding Using R and a Local PostGIS Database

Most states like New York have Street Address Management system where you can download every address in the state as a Shapefile then upload it to a locally running PostGIS database.

library(tidyverse)
library(RPostgreSQL)
library(sf)

con <- DBI::dbConnect(RPostgres::Postgres(), dbname='gis', host='localhost', 
                      port=5432, user='postgres', password='xxxxx')

# function that uses PostGIS query to return the closest
# point in the SAM database
reverseGeocode <- function(geom) {
  # convert sf geom object to text
  geom <- st_as_text(geom)
  
  # query
  sql <- str_c("
SELECT 
  *,
  \"Shape\" <-> 'SRID=26918;", geom, "'::geometry AS dist
FROM
  nys_sam_points
ORDER BY
  dist
LIMIT 1;")
  
  query <- dbGetQuery(con, sql)
  
  str_c(query$addresslabel, 
        ', ',
        query$citytownname,
        ', NY ',
        query$zipcode
        ) %>% return
}

# obtain centroids for each county
ny.county.centroids <- tigris::county_subdivisions('ny') %>% 
  st_centroid()

# get addresses of properties by reverse gecoding
ny.county.centroids %>%
  st_transform(26918) %>%   # use same projection 
                            # as your postgis database
  mutate(
    # obtain address using purr and map_chr using the 
    # reverseGeocode Function defined above
    Address = map_chr(geometry, reverseGeocode)
  )

For locations that don’t have points in SAM database, you can interpolate an address from the SAM Streets file.

library(tidyverse)
library(RPostgreSQL)
library(sf)

con <- DBI::dbConnect(RPostgres::Postgres(), dbname='gis', host='localhost', 
                      port=5432, user='postgres', password='xxxxx')

# function that uses PostGIS query to interpolate an address from the 
# streeet high and low adress
reverseGeocode <- function(geom) {
  # convert sf geom object to text
  geom <- st_as_text(geom)
  
  # query
  sql <- str_c("
SELECT 
  CAST (
  (leftfromaddress +
  (righttoaddress - leftfromaddress) *  ST_LineLocatePoint(ST_LineMerge(roadline), 'SRID=26918;", geom, "'::geometry)) AS integer) AS hno,
  completestreetname, leftzipname
  
  FROM (
SELECT 
  CAST(leftfromaddress AS double precision), CAST(righttoaddress AS double precision), completestreetname, leftzipname,
  \"Shape\" as roadline,
  \"Shape\" <-> 'SRID=26918;", geom, "'::geometry AS dist
FROM
  nys_sam_streets
ORDER BY
  dist
LIMIT 1)")
  
  
  dbGetQuery(con, sql)
  
  query <- dbGetQuery(con, sql)
  
  str_c(query$hno %>% as.character() %>% replace_na(''), 
        ' ',
        query$completestreetname,
        ', ',
        query$leftzipname,
        ', NY ',
        query$leftpostal
  ) %>% return
}

# obtain centroids for each county
ny.county.centroids <- tigris::county_subdivisions('ny') %>% 
  st_centroid()

# get addresses of properties by reverse gecoding
ny.county.centroids %>%
  st_transform(26918) %>%   # use same projection 
                            # as your postgis database
  mutate(
    # obtain address using purr and map_chr using the 
    # reverseGeocode Function defined above
    Address = map_chr(geometry, reverseGeocode)
  )

Thematic Map: US Population Non Contiguous Cartogram
Thematic Map: 2020 US Presidential Election Cartogram