d3.geo

What is the proper way to use D3's projection.stream()?

岁酱吖の 提交于 2020-01-13 07:32:48
问题 So I'm experimenting a bit with D3's geo stream API , and things feel a bit hazy. I've been reading through the documentation here: https://github.com/mbostock/d3/wiki/Geo-Streams One point of confusion I have is the proper implementation of stream transforms. Let's say I create one: //a stream transform that applies a simple translate [20,5]: var transform = d3.geo.transform({ point:function(){this.stream.point(x+20,y+5)} }) Per the documentation, this.stream references the "wrapped stream."

D3 V4 Properly placing a bubble in the US Map

给你一囗甜甜゛ 提交于 2019-12-20 05:25:37
问题 I am creating a US Map and I have a series of ACTUAL coordinates of some places in US. I would like to put a point or bubble on the right spot in the map. How do I scale/translate these? This is what I get: With what I have tried: function USAPlot(divid, data) { var margin = { top: 20, right: 20, bottom: 30, left: 50 }, width = 1040 - margin.left - margin.right, height = 700 - margin.top - margin.bottom; // formatting the data data.forEach(function (d) { d.loc = d.location; d.count = d.count;

d3.geo.tile point-to-point path not showing for varying widths

☆樱花仙子☆ 提交于 2019-12-20 04:21:26
问题 I have been following this block example to show nodes and paths as landmarks and roads. I have successfully loaded the map and I am able to zoom in enough to a "street view" level. I have also successfully added nodes following the example. My problem, however, is that my paths are mostly straight PointA-to-PointB paths. I have been implementing them as M(sourcex),(sourcey)L(targetx),(targety) before I added the map. Now, the paths won't show up unless the width was set to EXACTLY 0.9 / zoom

D3.geo : Spherical arcs rather than straight lines for parallels?

倾然丶 夕夏残阳落幕 提交于 2019-12-18 04:19:11
问题 I just made a D3js globe localisator, which looks like this : If you look carefully, the red square looks ugly since it doesn't follow the Earth's curve. I have the area bounding box in decimal degrees : var bb = {W:-5.0, N:50.0, E:10.0, S:40.0 } And I draw the lines as follow: svg.append("path") .datum({type: "LineString", coordinates: [[-5, 40], [-5, 50], [10, 50], [10, 40], [-5, 40]] }) .attr("d", path); For larger areas, it's even the opposite curve from expectations (for a bounding box):

Compose two rotations in D3 geo projection?

我怕爱的太早我们不能终老 提交于 2019-12-10 11:28:29
问题 Having fun with D3 geo orthographic projection to build an interactive globe, based on all the great examples I found. You can see my simple mockup at http://bl.ocks.org/patricksurry/5721459 I want the user to manipulate the globe like a trackball (http://www.opengl.org/wiki/Trackball). I started with one of Mike's examples (http://mbostock.github.io/d3/talk/20111018/azimuthal.html), and improved slightly to use canvas coordinates and express the mouse locations in 'trackball coordinates' (i

Compose two rotations in D3 geo projection?

 ̄綄美尐妖づ 提交于 2019-12-06 05:58:05
Having fun with D3 geo orthographic projection to build an interactive globe, based on all the great examples I found. You can see my simple mockup at http://bl.ocks.org/patricksurry/5721459 I want the user to manipulate the globe like a trackball ( http://www.opengl.org/wiki/Trackball ). I started with one of Mike's examples ( http://mbostock.github.io/d3/talk/20111018/azimuthal.html ), and improved slightly to use canvas coordinates and express the mouse locations in 'trackball coordinates' (i.e. rotation around canvas horizontal and vertical axes) so that a fixed mouse movement gives more

line on d3 map not forming a curve

流过昼夜 提交于 2019-12-06 03:32:22
问题 I have created a map using d3.js. I want to show a curved line between two locations. I am able to show a line, but sometimes it does not form a perfect curve. For some lines, the lines curve behind the map (across the anti-meridian) to their destination. Here's a code pen demonstrating the problem: https://codepen.io/peeyush-pant/pen/WqbPax And an image: Here's my projection data: var projection = d3.geoEquirectangular(); var path = d3.geoPath() .projection(projection); And here's how I draw

line on d3 map not forming a curve

允我心安 提交于 2019-12-04 07:23:08
I have created a map using d3.js. I want to show a curved line between two locations. I am able to show a line, but sometimes it does not form a perfect curve. For some lines, the lines curve behind the map (across the anti-meridian) to their destination. Here's a code pen demonstrating the problem: https://codepen.io/peeyush-pant/pen/WqbPax And an image: Here's my projection data: var projection = d3.geoEquirectangular(); var path = d3.geoPath() .projection(projection); And here's how I draw the lines: arcGroup.selectAll("myPath") .data(links) .enter() .append("path") .attr("class", "line")

d3.geo.tile point-to-point path not showing for varying widths

拜拜、爱过 提交于 2019-12-02 03:54:20
I have been following this block example to show nodes and paths as landmarks and roads. I have successfully loaded the map and I am able to zoom in enough to a "street view" level. I have also successfully added nodes following the example. My problem, however, is that my paths are mostly straight PointA-to-PointB paths. I have been implementing them as M(sourcex),(sourcey)L(targetx),(targety) before I added the map. Now, the paths won't show up unless the width was set to EXACTLY 0.9 / zoom.scale() which does not work for me. I need the paths to vary in width depending on data but even

How to fix map boundaries on d3 cartographic raster reprojection?

邮差的信 提交于 2019-11-29 20:29:16
问题 I try to use the raster reprojection of a map following this example. If I change the example kavrayskiy7 projection by the Azimuthal Equidistant projection, var projection = d3.geo.azimuthalEquidistant() .scale(90) .translate([width / 2, height / 2]) .clipAngle(180 - 1e-3) .precision(.1); it should project the Earth onto a disc (the image of the projection map). However, the raster reprojection goes beyond that disc and fills the entire canvas with an extended picture (the inverse projection