4

I'm trying to convert between two arbitrary projected coordinate reference systems, but every proj.4 library variant that I've tried has given a results different from QGIS's cs2cs application (which matches EPSG.io's results).

So, for transforming the point (572084.7402, 4542311.793) metres, the expected result is (980191.1775, 1086873.446), but the libraries return (980156.3975, 1087102.081). The jsfiddle is here: http://jsfiddle.net/dougy83/nfr62bj1/2/ , which includes the proj4 definitions for the reference systems.

I've used are the JS, C and .NET versions of the proj.4 library, and they all give the wrong value.

I've used the QGIS cs2cs, and EPSG.io and mygeodata.cloud/cs2cs/ websites, which all give what I assume is the correct answer. The cs2cs code appears to just call the pj_transform function, which is all I'm doing for the C version library.

Could someone please provide some help with this? I keep seeing references to the datum shift / grid shift files; is this related to this problem?

Proj4 definitions are duplicated here:

source: +proj=lcc +lat_1=30.28333333333333 +lat_2=28.38333333333333 +lat_0=27.83333333333333 +lon_0=-99 +x_0=600000 +y_0=3999999.9998984 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=us-ft +no_defs
dest: +proj=lcc +lat_1=27.41666666666667 +lat_2=34.91666666666666 +lat_0=31.16666666666667 +lon_0=-100 +x_0=914400 +y_0=914400 +datum=NAD27 +units=ft +no_defs
1

You're converting between EPSG:2278 (assuming NAD83, state plane Texas south central) and EPSG:3080 (NAD27 Texas statewide Mapping System in int'l feet).

You need to add +nad83 to the input, add +nadgrids=conus somewhere and download the grid files if you don't have them.

For information on nadgrids, http://proj4.org/parameters.html#nadgrids-grid-based-datum-adjustments

For information on grid files themselves, http://proj4.org/grids.html

  • Thanks for the response. The source is EPSG:2919. Adding +nad83 didn't change the result, and adding +nadgrids=conus to the input definition made the output values very small i.e. (-1.79, 0.085). I'm confused, because supplying the original definitions (which I got from from epsg.io) to the cs2cs command line app or website give the expected answer. If the grid files aren't being found, for whatever reason, what kind of magnitude of error would be expected? – James Brown Oct 24 '17 at 23:56
  • I get the impression that without the grid files, the error should only be a few feet, and not the 300 or so feet that I'm getting from the proj4 libraries – James Brown Oct 26 '17 at 0:26
  • Nope 300ft is about right for nad27 - nad83. You're also missing the nad83 -harn ygm but that's much smaller, under a meter in most places. – mkennedy Oct 26 '17 at 1:09

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.