Public
Edited
Dec 16
Insert cell
Insert cell
chart = {
const width = 900,//pixel size of the map
height = 900;
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width-50, height-10]);

// Use Mercator projection
var projection = d3
.geoMercator()//projection system used
.fitSize([width, height], bboxMiami);//out bounding box is here

var path = d3.geoPath().projection(projection);//need one of these for each line layer from qgis
var path2 = d3.geoPath().projection(projection);
var path3 = d3.geoPath().projection(projection);
var path4 = d3.geoPath().projection(projection);
var path5 = d3.geoPath().projection(projection);


var g = svg.selectAll('g').attr("id", "paths");//qgis lines variable //one variable for each geometry type
var c = svg.selectAll("circle")//for circles
var p = svg.selectAll("polyline")//for polylines from rhino
var t = svg.selectAll("text")
var l = svg.selectAll("line")


//static lines from qgis
//staticLines(path3, subways.features,"none",1,.5,"rgb(180,180,180)")
staticLines(path, hexagonMiamiMerge.features,"rgb(200,225,200)",'.25','.1',"rgb(0,255,0)")

function staticLines(path, data, sfill, sOpac, sW, stroke){

g.enter().append("path")
.data(data) //get data to define path
.enter() //there are more data than elements, this selects them
.append("path") //appends path to data
.attr('class','outlines')
.attr("d", path) //The d attribute defines a path to be drawn, only applies to appended elements
.style("fill", fillcolor)
.style('stroke-opacity',"black")
.style("stroke-width", "1")
.style("stroke", stroke)
}

function fillcolor(){
var color = 'rgb(255,0,0)'
}

//static points from qgis
//lines from rhino
polyline(radiusButton1,'red','1','0','none','angles')

function polyline(data, sfill, sOpac, sW, stroke,classVar){

g.enter().append("polyline")
.data(data) //get data to define path
.enter() //there are more data than elements, this selects them
.append('polyline')
.attr('class',classVar)
.attr("points", function(d){return d}) //The d attribute defines a path to be drawn, only applies to appended elements
.style("fill", sfill)
.style("fill-opacity", .5) // Fully transparent fill
.style('stroke-opacity',sOpac)
.style("stroke-width", sW)
.style("stroke", stroke)
}


//display names from spreadsheet - use this format for points from SPREADSHEET

//points from spreadsheet

return svg.node();
}
Insert cell
radiusButton1 = FileAttachment("radius button 1.txt").tsv({array:true})
Insert cell
bboxMiami = FileAttachment("bbox miami.geojson").json()
Insert cell
hexagonMiamiMerge = FileAttachment("hexagon miami merge.geojson").json()
Insert cell
hexagon_nol_merge6 = FileAttachment("hexagon_nol_merge6.geojson").json()
Insert cell
hexagon_nol_merge5 = FileAttachment("hexagon_nol_merge5.geojson").json()
Insert cell
hexagon_nol_merge3 = FileAttachment("hexagon_nol_merge3.geojson").json()
Insert cell
redlinesNol = FileAttachment("redlines nol.geojson").json()
Insert cell
road = FileAttachment("road.geojson").json()
Insert cell
NY_buildinge_map = 'https://docs.google.com/spreadsheets/d/e/2PACX-1vTbxm-eIKmRfJFocii7kfg0eQf9926Q5n3mh8Ftg-q5lEBoyU55SQuv4mBibeUVV5Q9yTB5yw4T6UjC/pub?output=csv'
Insert cell
new_museum = FileAttachment("new_museum.txt").tsv({array:true})
Insert cell
whitney = FileAttachment("whitney.txt").tsv({array:true})
Insert cell
zone1 = FileAttachment("zone1.txt").tsv({array:true})
Insert cell
wireframe = FileAttachment("wireframe.txt").tsv({array:true})
Insert cell
icon1 = FileAttachment("icon1.txt").tsv({array:true})
Insert cell
Insert cell
mouth = FileAttachment("mouth.txt").tsv({array:true})
Insert cell
eyes = FileAttachment("eyes.txt").tsv({array:true})
Insert cell
face_outline = FileAttachment("face_outline.txt").tsv({array:true})
Insert cell
bbox_new = FileAttachment("bbox_new.geojson").json()
Insert cell
graphic_test = FileAttachment("graphic_test.txt").tsv({array:true})
Insert cell
bbox1 = FileAttachment("bbox@1.geojson").json()
Insert cell
Insert cell
theaters = FileAttachment("theaters.geojson").json()
Insert cell
restrooms = FileAttachment("restrooms.geojson").json()
Insert cell
subways = FileAttachment("subways.geojson").json()
Insert cell
parks = FileAttachment("parks.geojson").json()
Insert cell
dining_lines = FileAttachment("dining_lines.geojson").json()
Insert cell
Insert cell
spots = d3.csv(spotsLink,d3.autoType)
Insert cell
import { wrap_text, wrap_text_nchar } from "@ben-tanen/svg-text-and-tspan-word-wrapping"
Insert cell
parkZone = FileAttachment("park zone.geojson").json()
Insert cell
bboxNol = FileAttachment("bbox nol.geojson").json()
Insert cell
hexagon = FileAttachment("hexagon.geojson").json()
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more