This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Add a line to a map using a GeoJSON source</title> | |
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no"> | |
<link href="https://api.mapbox.com/mapbox-gl-js/v3.2.0/mapbox-gl.css" rel="stylesheet"> | |
<script src="https://api.mapbox.com/mapbox-gl-js/v3.2.0/mapbox-gl.js"></script> | |
<style> | |
body { margin: 0; padding: 0; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df <- sf::st_read("M274_parcels_CY22_FY23_sde.gdb", layer = "M274Assess") |> | |
dplyr::mutate( | |
simp = dplyr::case_when( | |
stringr::str_detect(USE_CODE, "^0?101") ~ "101", | |
stringr::str_detect(USE_CODE, "^0?104") ~ "104", | |
stringr::str_detect(USE_CODE, "^0?105") ~ "105", | |
stringr::str_detect(USE_CODE, "^0?109") ~ "109", | |
stringr::str_detect(USE_CODE, "^0?111") ~ "111", | |
stringr::str_detect(USE_CODE, "^0?112") ~ "112", | |
), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidycensus) | |
library(dplyr) | |
library(tidyr) | |
library(gt) | |
# vars <- tidycensus::pums_variables %>% | |
# dplyr::filter(year == 2017, survey == "acs5") | |
# | |
# vars_housing <- vars %>% | |
# dplyr::filter(level == "housing") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import geopandas as gpd | |
import pandas as pd | |
import contextily as ctx | |
from rasterio import open as rioopen | |
from rasterio import band | |
from rasterio.mask import mask | |
from rasterio.plot import reshape_as_image, show | |
from rasterio.transform import Affine | |
from rasterio.warp import calculate_default_transform, reproject, Resampling | |
import rioxarray |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
output: | |
pdf_document: default | |
--- | |
# Spatial Multilevel Modeling of Life Expectancy | |
```{r message=FALSE, warning=FALSE, echo=FALSE} | |
require('tidycensus') | |
require('readstata13') | |
require('stringr') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('tidyverse') | |
require('tidycensus') | |
library('jsonlite') | |
require('sf') | |
census_api_key("<yourapikey>") | |
stops <- fromJSON("https://api-v3.mbta.com/stops/?filter[route]=Red", simplifyVector = TRUE)[[1]]$attributes %>% | |
st_as_sf(coords = c('longitude', 'latitude')) %>% | |
st_set_crs(4326) %>% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from qgis import * | |
import processing | |
proj_path = QgsProject.instance().readPath("./") | |
layers = iface.mapCanvas().layers() | |
for n, i in enumerate(layers): | |
ext = i.extent() | |
size = 5280 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import glob | |
import geojson | |
json_dir_name = "./" | |
json_pattern = os.path.join(json_dir_name,'*.geojson') | |
file_list = glob.glob(json_pattern) | |
collection = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# In this global.R field, we create all objects and run all code | |
# that we only want to run once when we start our app and that we | |
# want accessible to all parts of our app. This includes database | |
# queries (in this case at least), API keys, etc. | |
# | |
# First, we load and attach packages. A package must be installed before | |
# loading; for example, to install RPostgreSQL, we simply type | |
# install.packages("RPostgreSQL"). | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var nwCorner = L.latLng(42.341055,-71.07289), | |
seCorner = L.latLng(42.398887,-70.948951), | |
bounds = L.latLngBounds(nwCorner, seCorner) | |
// Create Leaflet map object | |
var map = L.map('parcelMap',{ | |
center: [42.371353, -71.034150], | |
zoom: 15, | |
minZoom: 14, |
NewerOlder