If your maps are always going to be in a projected coordinate system, that is locations are expressed in linear units, then you just need to know which units it's in and multiply by the relevant conversion factor. For instance, read in the epsg
file that comes with proj.4, and parse it for the +units
parameter or the +to_meters
parameter.
If, however, you're going to get unprojected data, that is in a geographic CS, you're going to have to learn the ins and outs of datum shifts and projections.
I'd be inclined to download the source for proj.4 and study it carefully, then find a couple of good books on the mathematics of map projections. If you want to cover every coordinate system, you're going to have to essentially rewrite significant chunks of proj.4.
Because you don't know where in the world your map is likely to be, the basic steps would be to shift the datum to a common standard such as WGS84, then I'd determine which UTM zone your rectangle is in and project it to that zone. From there you can calculate your random box, not forgetting that a rectangular region in a geographic CS is unlikely to be rectangular after it's projected, so you'll have to account for a skewed, warped, and curved initial bounding box (or if you're using UTM and your data is near the poles, you're going to have to choose another projection) to make sure your random box doesn't extend outside it.
Then if you want to get the extents of your random box back into the original CS, you'll need to reverse the process, which of course means it almost certainly won't be quite rectangular, although 100m isn't too big a deal.
The bounds are the area that the projection is "well defined" for. The most well known example of a poorly behaved projection is spherical mercator as you move towards the poles (>85 degrees). The projected bounds is this area in the units and projection of the CRS you are interested in while WGS84 bounds are those corners (un)projected in to WGS84.
So I would guess (and with out reading the manual or the code its hard to tell) that the AutoCad developers decided to avoid the risk of mathematical instability or unacceptable errors creeping in and limited you to the safe bounds.
Best Answer
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.
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:
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.
I looked at the gka repo which also includes bounds:
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.