Put a real coordinate on a map in d3.js

烂漫一生 提交于 2019-12-31 03:56:26

问题


I currently have an animation that moves a circle from the centroid of a region corresponding to one department, to another.

        var arc = g.append("path")
        .style("fill", "none")
        .style("stroke", "yellow")
        .style("stroke-width", 2)
        .attr("d", "M" + centroids.ANTIOQUIA[0] + "," + centroids.ANTIOQUIA[1] + " Q" + centroids.BOYACA[0] + "," + centroids.ANTIOQUIA[1] + " " + centroids.BOYACA[0] + "," + centroids.BOYACA[1]);

      var circle = g.append("circle")
        .attr("fill", "blue")
        .attr("r", 4)
        .style("opacity", 0)
        .attr("transform", "translate(" + centroids.ANTIOQUIA[0] + "," + centroids.ANTIOQUIA[1] + ")");

      circle.transition()
        .delay(1000)
        .duration(1000)
        .style("opacity", 1)
        .transition()
        .duration(8000)
        .attrTween("transform", translateAlong(arc.node(), circle.node()))
        .transition()
        .duration(1000)
        .style("opacity", 0);

I want the animation to start from the point I'm indicating in the image( more or less),

to a real coordinate drawn from google maps.

Colombia/@5.0653397,-75.5230936,15z/

But this time from the point I indicated in the image to a real coordinate. How can I do it? thanks.

http://jsfiddle.net/v4x8s3tw/

来源:https://stackoverflow.com/questions/45651584/put-a-real-coordinate-on-a-map-in-d3-js

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!