Not recognizing projection
GretaCB opened this issue · 4 comments
The following projection file content returns undefined
for the proj4 parameter:
PROJCS["NAD_1983_StatePlane_Maryland_FIPS_1900",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",400000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-77.0],PARAMETER["Standard_Parallel_1",38.3],PARAMETER["Standard_Parallel_2",39.45],PARAMETER["Latitude_Of_Origin",37.66666666666666],UNIT["Meter",1.0]]
result
object after running the projection file data through srs.parse:
{ input: 'PROJCS["NAD_1983_StatePlane_Maryland_FIPS_1900",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",400000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-77.0],PARAMETER["Standard_Parallel_1",38.3],PARAMETER["Standard_Parallel_2",39.45],PARAMETER["Latitude_Of_Origin",37.66666666666666],UNIT["Meter",1.0]]',
proj4: undefined,
srid: undefined,
auth: undefined,
pretty_wkt: 'PROJCS["NAD_1983_StatePlane_Maryland_FIPS_1900",\n GEOGCS["GCS_North_American_1983",\n DATUM["D_North_American_1983",\n SPHEROID["GRS_1980",6378137.0,298.257222101]],\n PRIMEM["Greenwich",0.0],\n UNIT["Degree",0.0174532925199433],\n AUTHORITY["EPSG","4269"]],\n PROJECTION["Lambert_Conformal_Conic"],\n PARAMETER["False_Easting",400000.0],\n PARAMETER["False_Northing",0.0],\n PARAMETER["Central_Meridian",-77.0],\n PARAMETER["Standard_Parallel_1",38.3],\n PARAMETER["Standard_Parallel_2",39.45],\n PARAMETER["Latitude_Of_Origin",37.66666666666666],\n UNIT["Meter",1.0]]',
esri: false,
name: 'NAD_1983_StatePlane_Maryland_FIPS_1900',
valid: false,
is_geographic: false }
Should be fixed now. The problem was that projections written by ESRI software often have subtle differences and to parse them correctly OGR's OSR code needs to try to parse them as ESRI variants, which internally "morphs" the projection in known ways in order to try to detect it later on. In most cases projections that are "ESRI variants" will cause an error internally in node-srs's c++ bits and I can that error and then fall back to trying to parse projectsions as "ESRI variants" In this case no error was thrown so a parse as ESRI was never attempted. I've modified the code to test for an undefined proj4
attribute as another reason to try falling back to parsing as ESRI.
In short if you hit this again try appending ESRI::
to the raw string of the .prj which is the way to manually trigger parsing the projection as an ESRI variant.
Thanks @springmeyer !!!
Hey @springmeyer, just FYI, still getting undefined proj4 for ESRI projections after updating to the new version. I manually appended ESRI:: to the .prj file string, and this succeeded. I am currently working on a workaround within unpacker-shapefile.