chart = {
const width = 960,
height = 900;
const svg = d3.create("svg")
.attr("viewBox", [50, 50, width-100, height-100]);
var projection = d3
.geoMercator()
.fitSize([width - 50, height - 50], boundingbox1);
svg
.append('rect')
.attr('fill',"rgb(34, 38, 72)")
.attr('stroke',"rgb(0,0,0)")
.attr('stroke-width',"3px")
.attr('x',0)
.attr('y',0)
.attr('width',"1000")
.attr('height',"1000")
var path1 = d3.geoPath().projection(projection);
var path2 = d3.geoPath().projection(projection);
var path3 = d3.geoPath().projection(projection);
var g = svg.append("g").attr("id", "paths");
g.selectAll("path8")
.data(grid100m.features)
.enter()
.append("path")
.attr('class','outlines')
.attr("d", path3)
.style("fill", "rgb(255, 255, 255)")
.style("fill-opacity", "0")
.style('stroke-opacity','.4')
.style("stroke-width", '.2')
.style("stroke", "rgb(255,255,255)")
g.selectAll("path9")
.data(grid1km.features)
.enter()
.append("path")
.attr('class','outlines')
.attr("d", path3)
.style("fill", "rgb(255, 255, 255)")
.style("fill-opacity", "0")
.style('stroke-opacity','.4')
.style("stroke-width", '.5')
.style("stroke", "rgb(255,255,255)")
g.selectAll("path7")
.data(roadline.features)
.enter()
.append("path")
.attr('class','outlines')
.attr('stroke-dasharray','4 4')
.attr("d", path3)
.style("fill", "rgb(255, 255, 255)")
.style("fill-opacity", "0")
.style('stroke-opacity','.4')
.style("stroke-width", '1')
.style("stroke", "white")
g.selectAll("path5")
.data(footprint.features)
.enter()
.append("path")
.attr('class','outlines')
.attr("d", path3)
.style("fill", "rgb(52, 96, 137)")
.style("fill-opacity", "1")
.style('stroke-opacity',"1")
.style("stroke-width", '0.5')
.style("stroke", "rgb(24, 18, 54)")
g.selectAll("path3")
.data(park1.features)
.enter()
.append("path")
.attr('class','outlines')
.attr("d", path3)
.style("fill", "rgb(170, 125, 163)")
.style("fill-opacity", "1")
.style('stroke-opacity','.4')
.style("stroke-width", '.5')
.style("stroke", "rgb(0,0,0)")
g.selectAll("path4")
.data(os1.features)
.enter()
.append("path")
.attr('class','outlines')
.attr("d", path3)
.style("fill", "rgb(81, 207, 247)")
.style("fill-opacity", ".5")
.style('stroke-opacity','.4')
.style("stroke-width", '.5')
.style("stroke", "black")
g.selectAll("path2")
.data(subline1.features)
.enter()
.append("path")
.attr('class','outlines')
.attr("d", path2)
.style("fill", "none")
.style('stroke-opacity','1')
.style("stroke-width", '1.5')
.style("stroke", "rgb(61, 179, 207)")
g.selectAll("path6")
.data(siteZone.features)
.enter()
.append("path")
.attr('class','outlines')
.attr('stroke-dasharray','12 10')
.attr("d", path3)
.style("fill", "rgb(200, 200, 200)")
.style("fill-opacity", "0")
.style('stroke-opacity','.8')
.style("stroke-width", '3')
.style("stroke", "rgb(50, 214, 137)")
var t = svg.selectAll("text")
.data(subwaystop.features)
.enter()
.append("text")
.attr("x", function(d) {return path1.centroid(d)[0]})
.attr("y", function(d) {return path1.centroid(d)[1]-5})
.attr('font-family','helvetica')
.attr('font-size','.6em')
.attr('font-weight','100')
.style("fill", "rgb(180, 180,180)")
.attr('text-anchor','middle')
.text(function(d) {return d.properties.name})
g.selectAll("path10")
.data(routeline01.features)
.enter()
.append("path")
.attr('class','outlines')
.attr("d", path3)
.style("fill", "rgb(255, 255, 255)")
.style("fill-opacity", "0")
.style('stroke-opacity','1')
.style("stroke-width", '3')
.style("stroke", "rgb(50, 214, 137)")
g.selectAll("path11")
.data(routeline02.features)
.enter()
.append("path")
.attr('class','outlines')
.attr("d", path3)
.style("fill", "rgb(255, 255, 255)")
.style("fill-opacity", "0")
.style('stroke-opacity','.8')
.style("stroke-width", '.5')
.style("stroke", "rgb(247, 217, 103)")
.on('mouseover', potMouse)
.on('mouseout', potMouseout)
function potMouse(event,d){
d3.select(this).style("stroke-width", '2')
d3.select(this).style("stroke", 'white')
}
function potMouseout(event,d){
d3.select(this).style("stroke-width", '1')
d3.select(this).style("stroke", 'white')
}
var c = svg.selectAll("circle")
.data(subwayStop.features)
.enter()
.append("circle")
.attr("cx", function(d) {return path1.centroid(d)[0]})
.attr("cy", function(d) {return path1.centroid(d)[1]})
.attr('r',3.5)
.attr('fill', "rgb(188, 223, 223)")
.style('fill-opacity',"1")
var c = svg.selectAll("circle03")
.data(nypdShootingIncidentDataYearToDate.features)
.enter()
.append("circle")
.attr("cx", function(d) {return path1.centroid(d)[0]})
.attr("cy", function(d) {return path1.centroid(d)[1]})
.attr('r',4)
.attr('fill', "rgb(247, 217, 103)")
.style('fill-opacity','1')
.style("stroke-width", '1')
.style("stroke", "rgb(0, 0, 0)")
.on('mouseover', SpotMouse)
.on('mouseout',SpotMouseout)
function SpotMouse(event,d){
d3.select(this).attr('r',8)
svg
.append('text')
.attr('x',"75")
.attr('y',"100")
.attr('class',"review")
.attr('font-family',"Helvetica")
.attr('font-size',"1em")
.style('dont-weight',"bold")
.style('fill',"rgb(255,255,255)")
.text(d.properties.occur_date)
svg
.append('text')
.attr('x',"75")
.attr('y',"120")
.attr('class',"review")
.attr('font-family',"Helvetica")
.attr('font-size',"1em")
.style('dont-weight',"bold")
.style('fill',"rgb(255,255,255)")
.text(d.properties.occur_time)
svg
.append('text')
.attr('x',"75")
.attr('y',"140")
.attr('class',"review")
.attr('font-family',"Helvetica")
.attr('font-size',".8em")
.style('dont-weight',"bold")
.style('fill',"rgb(255,255,255)")
.text(d.properties.perp_race)
svg
.append('text')
.attr('x',"75")
.attr('y',"160")
.attr('class',"review")
.attr('font-family',"Helvetica")
.attr('font-size',".8em")
.style('dont-weight',"bold")
.style('fill',"rgb(255,255,255)")
.text(d.properties.perp_age_group)
svg
.append('text')
.attr('x',"150")
.attr('y',"120")
.attr('class',"review")
.attr('font-family',"Helvetica")
.attr('font-size',"1em")
.style('dont-weight',"bold")
.style('fill',"rgb(255,255,255)")
.text(d.properties.loc_of_occur_desc)
}
function SpotMouseout(event,d){
d3.select(this).attr('r',4)
d3.selectAll('text.review').remove()
}
var c = svg.selectAll("circle02")
.data(policeStop.features)
.enter()
.append("circle")
.attr("cx", function(d) {return path1.centroid(d)[0]})
.attr("cy", function(d) {return path1.centroid(d)[1]})
.attr('stroke',"black")
.attr('stroke-width',"1px")
.attr('stroke-opacity',"1")
.attr('r',8)
.attr('fill', "rgb(255, 255, 255)")
.style('fill-opacity','1')
.on('mouseover', UAVMouse)
.on('mouseout', UAVMouseout)
function UAVMouse(event,d){
d3.select(this).attr('fill', "red")
d3.select(this).attr('r',12)
}
function UAVMouseout(event,d){
d3.select(this).attr('fill', "rgb(255, 255, 255)")
d3.select(this).attr('r',8)
}
svg
.append("text")
.attr('class','title')
.attr('x','480')
.attr('y','460')
.attr('font-family','helvetica')
.attr('font-size','1em')
.attr('font-weight','bold')
.style("fill", "rgb(236, 220, 98)")
.style("fill-opacity", "1")
.text('PATROL ZONE')
svg
.append('rect')
.attr('fill',"rgb(61, 179, 207)")
.attr('fill-opacity',".7")
.attr('stroke',"rgb(236, 220, 98)")
.attr('stroke-width',"2px")
.attr('stroke-opacity',".7")
.attr('x',730)
.attr('y',800)
.attr('width',160)
.attr('height',35)
svg
.append("text")
.attr('class','title')
.attr('x','480')
.attr('y','475')
.attr('font-family','helvetica')
.attr('font-size','.6em')
.attr('font-weight','bold')
.style("fill", "rgb(236, 220, 98)")
.style("fill-opacity", "1")
.text('FUTURE POLICE UAV')
scaleBar
.projection(projection)
.size([width, height]);
svg.append("g")
.call(scaleBar);
return svg.node();
}