3

I have a GeoJson polygon I am trying to draw in a 3d scene using d3 and three.js

I have done this before when the polygon was represented in lat, lng coordinates, but in my case the coordinate system is just integers between -10 and 10 for both x and y.

var path = d3.geo.path().projection(d3.geo.equirectangular().center([0,0]))
var contour = transformSVGPath(path(geoJSONObject));

However if I add this object to my scene, it is translated far away from its center (0, 0)

What am I doing wrong?

1 Answer 1

1

It turns out that when applying d3 projections, there is a default translation of [480, 250].

This can be overridden by setting the translation manually:

var projection = d3.geo.equirectangular();
projection.center([0,0]);
projection.translate([0,0]);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.