Ciao Nels,

I have checked your geotiff and yes its CRS is parsed incorrectly. The
problem is right where you spotted it, the management of the unit of
measure.

However, identifying the issue itself is not so trivial. The metadata
that your geotiff decalres are a bt funny (at least for my
not-so-extensive experience :-). I am attaching the geokey dir from
your file since you seems to be acquainted with tiff tags:

  <TIFFField number="34735" name="GeoKeyDirectory">
      <TIFFShorts>
        <TIFFShort value="1"/>
        <TIFFShort value="1"/>
        <TIFFShort value="0"/>
        <TIFFShort value="12"/>
        <TIFFShort value="1024"/>
        <TIFFShort value="0"/>
        <TIFFShort value="1"/>
        <TIFFShort value="1"/>
        <TIFFShort value="1025"/>
        <TIFFShort value="0"/>
        <TIFFShort value="1"/>
        <TIFFShort value="1"/>
        <TIFFShort value="2050"/>
        <TIFFShort value="0"/>
        <TIFFShort value="1"/>
        <TIFFShort value="6269"/>
        <TIFFShort value="2056"/>
        <TIFFShort value="0"/>
        <TIFFShort value="1"/>
        <TIFFShort value="7019"/>
        <TIFFShort value="3072"/>
        <TIFFShort value="0"/>
        <TIFFShort value="1"/>
        <TIFFShort value="32111"/>
        <TIFFShort value="3073"/>
        <TIFFShort value="34737"/>
        <TIFFShort value="80"/>
        <TIFFShort value="0"/>
        <TIFFShort value="3076"/>
        <TIFFShort value="0"/>
        <TIFFShort value="1"/>
        <TIFFShort value="9003"/>
        <TIFFShort value="3080"/>
        <TIFFShort value="34736"/>
        <TIFFShort value="1"/>
        <TIFFShort value="0"/>
        <TIFFShort value="3081"/>
        <TIFFShort value="34736"/>
        <TIFFShort value="1"/>
        <TIFFShort value="1"/>
        <TIFFShort value="3082"/>
        <TIFFShort value="34736"/>
        <TIFFShort value="1"/>
        <TIFFShort value="2"/>
        <TIFFShort value="3083"/>
        <TIFFShort value="34736"/>
        <TIFFShort value="1"/>
        <TIFFShort value="3"/>
        <TIFFShort value="3092"/>
        <TIFFShort value="34736"/>
        <TIFFShort value="1"/>
        <TIFFShort value="4"/>
      </TIFFShorts>
    </TIFFField>

The strange thing in your geotiff file is that it does declare to use
EPSG:32111 whose wkt is as follows:

PROJCS["NAD83 / New Jersey",
 GEOGCS["NAD83",
   DATUM["North American Datum 1983",
     SPHEROID["GRS 1980", 6378137.0, 298.257222101, AUTHORITY["EPSG","7019"]],
     TOWGS84[1.0, 1.0, -1.0, 0.0, 0.0, 0.0, 0.0],
     AUTHORITY["EPSG","6269"]],
   PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]],
   UNIT["degree", 0.017453292519943295],
   AXIS["Geodetic longitude", EAST],
   AXIS["Geodetic latitude", NORTH],
   AUTHORITY["EPSG","4269"]],
 PROJECTION["Transverse Mercator", AUTHORITY["EPSG","9807"]],
 PARAMETER["central_meridian", -74.5],
 PARAMETER["latitude_of_origin", 38.833333333333336],
 PARAMETER["scale_factor", 0.9999],
 PARAMETER["false_easting", 150000.0],
 PARAMETER["false_northing", 0.0],
 UNIT["m", 1.0],
 AXIS["Easting", EAST],
 AXIS["Northing", NORTH],
 AUTHORITY["EPSG","32111"]]

which is confirmed by the proj4 params:
<32111> +proj=tmerc +lat_0=38.83333333333334 +lon_0=-74.5 +k=0.999900
+x_0=150000 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs  <>


Funny thing (at least IMHO) is that your geodir claims to use the
standard EPSG:32111, see

        <TIFFShort value="3072"/>
        <TIFFShort value="0"/>
        <TIFFShort value="1"/>
        <TIFFShort value="32111"/>
while at the same time it declares some other parameters, like as an instance:
GeogGeodeticDatumGeoKey
       <TIFFShort value="2050"/>
       <TIFFShort value="0"/>
       <TIFFShort value="1"/>
       <TIFFShort value="6269"/>


GeogEllipsoidGeoKey
       <TIFFShort value="2056"/>
       <TIFFShort value="0"/>
       <TIFFShort value="1"/>
       <TIFFShort value="7019"/>

ProjLinearUnitsGeoKey
       <TIFFShort value="3076"/>
       <TIFFShort value="0"/>
       <TIFFShort value="1"/>
       <TIFFShort value="9003"/>

The GeoTiff specification states what follows for parsing Projected
Coordinate Reference System, page 38:

"With the exception of the first two keys, these are mostly projection specific
parameters, and only a few will be required for any particular
projection type. Projected coordinate systems automatically imply a
specific projection type, as well as specific parameters for that
projection, and so the keys below will only be necessary for userdefined
projected coordinate systems."

My understanding of this has always been, if I give you a code for a
specific PCRS og GCRS go with it, if I tell you this is a user defined
CRS parse the specific params. This is the reason why in this case I
ingored the other params your geotiff is carrying around.

However, I have sent an email to the geotiff mailing list and to some
other people in order to see if someone already ran into similar issue
and to get also a feeling about the common practice, if one exists.


A possible solution would be using the modifying EPSG:32111
accordingly to the specific params your geotiff is declaring. Anyway,
before implementing such behaviour I would really like to hear someone
else's opinion on this.


Hope that helps.
Regards,
Simone.

PS
The image, apart from the CRS issue, is loaded and visualized smoothly
and very very quickly, too bad...  :-)

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to