Hey all,
I was wondering if anyone had any experience with projecting geotiff images beneath data? I’m trying to draw relevant points from a dataset on top of a zoomable/pan-able map. My current method is:
create a projection using:
const projection = d3.geoIdentity()
.fitSize([width, height], geojson)
with geojson
being constructed from data represented as points.
Since the geotiff file gives me the coordinate extent, I’m trying to draw it to a canvas with:
const [px_min, py_min] = projection([min_coordx, min_coordy])
const [px_max, py_max] = projection([max_coordx, max_coordy])
canvas.drawImage(tiff, px_min, py_min,
Math.abs(px_max-px_min), Math.abs(py_max-py_min))
But the drawn map doesn’t seem to line up with the data points
for reference, the points are drawn with:
data.forEach(d => {
const [x,y] = projection([d.Longitude, d.Latitude])
// ... fillstyles
canvas.beginPath()
canvas.moveTo(x,y)
canvas.arc(x, y, radius, 0, 2.0*Math.PI)
})
I’m not sure exactly where I’m going wrong. Any help would be appreciated Thank you!