In D3.geo, how to obtain the data of a projection?

Asked

Viewed 16 times

-1

I am using only D3.geo, not the full D3 library, but only D3.geo.

Configure projection and upload Geojson Multipolygon data.

I get back the data as follows

projectionVale = d3.geo.stereographic()
.rotate(rotation)
.translate([width/2, height/2])
.scale([scale])
.clipAngle(90);

mapVale = d3.geo.path().projection(projectionVale);
path = mapVale(datajson);

This way it returns the paths already optimized and ready (which is the intention of D3 obviously) to plot in SVG.

How I return only the x,y data of this polygon of this projection preferably in an array?

Because I have no intention of using the D3 library to plot the data in canvas or SVG, only the D3.geo, because I only need the data so I can have the freedom to do other processing in this data and generate the graph on the screen the way I need it.

1 answer

0

As I was in great need, I decided to use a solution not ideal but functional.

In D3.geo there is a method called d3_geo_pathBuffer(), which contains the contents of the return projection. I simply changed the form of return to the form I needed.

At the moment it is not the ideal and clean solution, but it is functional for the necessary use.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.