4

Given an EPSG projection (say, this Alabama one: http://spatialreference.org/ref/epsg/26729/)

How can you take the given WGS84 projection bounds in such a way that you can use them in a D3.js projection.

For example, how would you know what projection, degree of rotation or bounding box to use to show the map?

  • 1
    I don't think you can use just the bounding box. You would need the projection parameters too. For instance, see veltman/d3-stateplane. The rotation is the negative of the central meridian, the negative of the latitude of origin (or maybe the central latitude), but the standard parallels are also defined if using Lambert conformal conic. With TM, the scale factor is missing. – mkennedy Feb 15 '17 at 22:45
  • I'm still confused. Have you looked at github.com/gka/d3-geo-state-plane/blob/master/state-plane.js – Learning stats by example Feb 15 '17 at 22:55
  • That set is for projected coordinate systems good for a state, not the state plane zones that you asked for. That why you only "AL" and not "AL-E" and "AL-W", for instance. – mkennedy Feb 15 '17 at 22:57
  • Sure it just also says that it's based on EPSG in the same way: spatialreference.org/ref/epsg/26729 It's similar to the Veltman example. Any chance you could show the math for how one of these bounds and rotations are computed from an example? I get lost in your description. – Learning stats by example Feb 15 '17 at 22:59
  • 1
    Oh, I see. My mistake. The names are very misleading--and it's a partial list then. "AL" is the Alabama East zone. Let me try to make an answer. – mkennedy Feb 15 '17 at 23:03
4

I'll try, but I've never used D3. I do know projections and the state plane system very well. Let's look at a full definition of EPSG::26729.

PROJCS["NAD27 / Alabama East",
    GEOGCS["NAD27",
        DATUM["North_American_Datum_1927",
            SPHEROID["Clarke 1866",6378206.4,294.9786982138982,
                AUTHORITY["EPSG","7008"]],
            AUTHORITY["EPSG","6267"]],
        PRIMEM["Greenwich",0,
            AUTHORITY["EPSG","8901"]],
        UNIT["degree",0.01745329251994328,
            AUTHORITY["EPSG","9122"]],
        AUTHORITY["EPSG","4267"]],
    UNIT["US survey foot",0.3048006096012192,
        AUTHORITY["EPSG","9003"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",30.5],
    PARAMETER["central_meridian",-85.83333333333333],
    PARAMETER["scale_factor",0.99996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    AUTHORITY["EPSG","26729"],
    AXIS["X",EAST],
    AXIS["Y",NORTH]]

There's a lot of information here.

So this repo says that scaling and translating are not done, so you have to handle those separately.

Translating are the false easting/false northing parameters. They 'reset' the origin of the projection from 0,0 to new values generally to make sure that all coordinates within the typical area of use are positive. In the state plane system, the zones that are more north-south use transverse Mercator and have a scale factor that reduces the overall distortion.

For the NAD83 version of Alabama East, the repo has:

var projection = d3.geoTransverseMercator()
  .rotate([85 + 50 / 60, -30 - 30 / 60]);

The rotation is moving the center of the projection, at latitude: 30.5 deg, longitude: -85.83333333333333 deg, to 0,0 of the display. To do that we need to rotate to the right by 85.83333333333333 or (85 + 50/60) (the projection's central meridian is actually defined as -85 degrees 50 minutes).

We also need to rotation down by -30.5, or (-30 - 30/60) as the latitude of origin is at 30 degrees 30 minutes North. You could instead use a latitude that's centered in the area of use, as the latitude of origin usually near the bottom of the area of use--also in order to make all the coordinates have positive values.

The Lambert conformal conic AKA conicConformal also has standard parallels so there's an extra option to define those.

var projection = d3.geoConicConformal() // Tennessee
  .parallels([35 + 15 / 60, 36 + 25 / 60])
  .rotate([86, -34 - 20 / 60]);

I looked at the gka repo which also includes bounds:

 "bounds": [[-0.039122,-0.079084],[0.013939,0.004511]] 

but I'm not seeing how they're converted from the values on the spatialreference .org site. They have been rotated but that's as much as I can tell.

Last but not least, I should mention that you picked a NAD27 zone. The repo examples are NAD83. These two geographic CRS / datums use different ellipsoids (Clarke 1866 versus GRS80). They also can have different units and thus different offset/translation values. Zone parameters often changed between NAD27 and NAD83 as well but often it was just the false easting/northing parameters.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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