chart = {
const width = 900,
height = 900;
const svg = d3.create("svg")
.attr("viewBox", [25, 0, width-100, height-100]);
var projection = d3
.geoMercator()
.fitSize([width - 50, height - 50], bbox1);
var path1 = d3.geoPath().projection(projection);
var path2 = d3.geoPath().projection(projection);
var path3 = d3.geoPath().projection(projection);
var path4 = d3.geoPath().projection(projection);
var g = svg.append("g").attr("id", "paths");
svg
.append("text")
.attr('x','25')
.attr('y','25')
.style('font-family','garamond')
.style('font-size','24px')
.style('font-weight','bold')
.text('London')
svg
.append("text")
.attr('x','25')
.attr('y','50')
.style('font-family','garamond')
.style('font-size','18px')
.style('font-weight','bold')
.text('Places To Visit:')
svg
.append("line")
.attr('x1','25')
.attr('y1','33')
.attr('x2','142')
.attr('y2','33')
.style("stroke-width", '1')
.style("stroke", "rgb(0,0,0)")
g.selectAll("path2") //d3 geopath
.data(underground.features) //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", path2) //The d attribute defines a path to be drawn, only applies to appended elements
.style("fill", "none")
.style('stroke-opacity','.5')
.style("stroke-width", '.5')
.style("stroke", "black")
g.selectAll("path3")
.data(base1.features)
.enter()
.append("path")
.attr('class','outlines')
.attr("d", path3)
.style("fill", "rgb(245,245,245)")
.style("fill-opacity", ".25")
.style('stroke-opacity','.1')
.style("stroke-width", '.5')
.style("stroke", "black")
g.selectAll("path3")
.data(brownfields.features)
.enter()
.append("path")
.attr('class','outlines')
.attr("d", path3)
.style("fill", "rgb(255,255,255)")
.style("fill-opacity", "1")
.style('stroke-opacity','.5')
.style("stroke-width", '.25')
.style("stroke", "black")
g.selectAll("path3")
.data(thames.features)
.enter()
.append("path")
.attr('class','outlines')
.attr("d", path3)
.style("fill", "rgb(0,0,0)")
.style("fill-opacity", ".65")
.style('stroke-opacity','1')
.style("stroke-width", '.1')
.style("stroke", "white")
var c = svg.selectAll("circle") //d3 geopath
.data(Points)
.enter() //there are more data than elements, this selects them
.append("circle") //appends path to data
.attr('class','pointsfr')
.attr("cx", function(d) {return projection([d.Long,d.Lat])[0]})
.attr("cy", function(d) {return projection([d.Long,d.Lat])[0]})
.attr('r',3)
.attr('fill','black')
.style('fill-opacity','1')
.on('mouseover',pointsinfo)
.on('mouseout',pointsinfoout)
function pointsinfo(event,d){
d3.select(this).attr('fill','red')
svg.append('text')
.attr('class','PointsText')
.attr('x','25')
.attr('y','75')
.attr("font-family","Garamond")
.style('font-weight','bold')
.style('font-weight','bold')
.attr("font-size","16px")
.attr('fill','black')
.attr('text-anchor','left')
.text(d.Name)
svg.append('text')
.attr('class','PointsText')
.attr('x','25')
.attr('y','100')
.attr("font-family","Garamond")
.style('font-weight','bold')
.style('font-weight','bold')
.attr("font-size","12px")
.attr('fill','black')
.attr('text-anchor','left')
.text(d.Description)
svg.append('line')
.attr('class','PointLine')
.attr('x1','30')
.attr('y1','100')
.attr('x2',projection([d.Long,d.Lat])[0])
.attr('y2',projection([d.Long,d.Lat])[0])
.style("stroke-width", '.5')
.style("stroke", "black")
.style('stroke-dasharray', '6 4')
var p = svg.selectAll("polyline")
.data(irons)
.enter() //there are more data than elements, this selects them
.append("polyline")
.attr('points',function(d){return d})
.attr('transform','translate(200,200)')
// .attr('transform','scale(5)')
.style("stroke-width", '.5')
.style("stroke", 'red')
.attr('fill','red')
p.enter().append("polyline")
.data(icon_list)
.enter() //there are more data than elements, this selects them
.append("polyline")
.attr('points',function(d){return d.pts})
.attr('transform',function(d){return'translate('+projection([d.data.Long,d.data.Lat])[0]+','+projection([d.data.Long,d.data.Lat])[1]+')'})
// .attr('transform','scale(.5)')
.style("stroke-width", '.5')
.style("stroke", 'red')
.attr('fill','red')
}
function pointsinfoout(event,d){
d3.selectAll('circle.pointsfr').attr('fill','black')
d3.selectAll('text.PointsText').remove()
d3.selectAll('line.PointLine').remove()
}
return svg.node();
}