d3 / d3-plugins

[DEPRECATED] A repository for sharing D3.js V3 plugins.
https://github.com/d3/d3/wiki/Plugins
Other
1.81k stars 684 forks source link

Well-known projection definitions. #44

Open mbostock opened 11 years ago

mbostock commented 11 years ago

It would be handy to have an easy way to lookup GIS-style projection definitions. For example, EPSG:2163 could map to:

d3.geo.azimuthalEqualArea().rotate([100, -45])

while ESRI:102003 would map to

d3.geo.albers().rotate([-96, 0]).center([0, 37.5]).parallels([29.5, 45.5])

And likewise maybe even support for parsing Proj4-style projection definitions of the form

+proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=37.5 +lon_0=-96 +x_0=0 +y_0=0
briantjacobs commented 8 years ago

+1 for this. A table to understand what proj4/wkt parameters map to d3 projection function arguments would be max helpful.

dnltsk commented 7 years ago

+1

briantjacobs commented 6 years ago

I still struggle with knowing what proj4 parameters map to D3 projection inputs. It's frustrating because parameters from Proj4 or WKT is all I have to lean on coming over from a GIS or shapefile/raster metadata.

@mbostock your examples above are a little confusing because in EPSG:2163, +lat_0=45 and +lon_0=-100 maps to .rotate([100, -45]). While in ESRI:102003 +lat_0=37.5 maps to .center([0, 37.5]) and +lon_0=-96 maps to .rotate([-96, 0]). Is the particular placement of parameters within the projection functions dependent on the projection chosen?

So I'm looking for help in filling out what D3 functions maps to what in this list from here http://proj4.org/parameters.html I've given it a start for the d3.geo.albers() example, in bold


+a Semimajor radius of the ellipsoid axis +alpha ? Used with Oblique Mercator and possibly a few others +azi +b Semiminor radius of the ellipsoid axis +belgium +beta +czech +e Eccentricity of the ellipsoid = sqrt(1 - b^2/a^2) = sqrt( f*(2-f) ) +ellps Ellipsoid name (see proj -le) +es Eccentricity of the ellipsoid squared +f Flattening of the ellipsoid = 1-sqrt(1-e^2) (often presented as an inverse, e.g. 1/298) +geoc +guam +h +k Scaling factor (old name) +K +k_0 Scaling factor (new name) D3: .rotate([xx,+lat_0 ] ): +lat_0 Latitude of origin D3: .parallels([+lat_1,xx ] ) :+lat_1 Latitude of first standard parallel D3: .parallels([xx,+lat_2 ] ): +lat_2 Latitude of second standard parallel +lat_b +lat_t +lat_ts Latitude of true scale D3: .center([+lon_0,xx ] ): +lon_0 Central meridian +lon_1 +lon_2 +lonc ? Longitude used with Oblique Mercator and possibly a few others +lsat +m +M +n +no_cut +no_off No offset. If present, do not offset origin to center of projection. Only used in Oblique Mercator projection. +no_uoff Backwards compatible version of +no_off. +no_rot +ns +o_alpha +o_lat_1 +o_lat_2 +o_lat_c +o_lat_p +o_lon_1 +o_lon_2 +o_lon_c +o_lon_p +o_proj +over +p +path +proj Projection name (see proj -l) +q +R +R_a +R_A Compute radius such that the area of the sphere is the same as the area of the ellipsoid +rf Reciprocal of the ellipsoid flattening term (e.g. 298) +R_g +R_h +R_lat_a +R_lat_g +rot +R_V +s +south Denotes southern hemisphere UTM zone +sym +t +theta +tilt +to_meter Multiplier to convert map units to 1.0m +units meters, US survey feet, etc. +vopt +W +westo +x_0 False easting +y_0 False northing +zone UTM zone


I've also been working with GOES-16 imagery and i don't even know where to start with this projection in D3

+proj=geos +a=6378137.0 +b=6356752.31414 +lon_0=-89.5 +lat_0=0 +f=0.003352810681 +h=35786023 +sweep=x

This example by @emeeks wasn't much help with the +a +b +f +h parameters

briantjacobs commented 6 years ago

The code on this page is a big clue for me. It outputs proj4 strings from chosen projections/parameters and renders it in a d3 map http://projectionwizard.org/