Opened 10 years ago

Closed 10 years ago

Last modified 9 years ago

#59 closed defect (fixed)

Suppling StdParallel1 with CT_Mercator, ie. Mercator_2SP, doesn't work

Reported by: tpiepho Owned by: warmerdam
Priority: normal Milestone:
Component: libgeotiff Version: 1.3.0
Keywords: mercator 2SP Cc:

Description

There is currently no way to specify a Mercator_2SP in a geotiff. The unofficial projection list, http://www.remotesensing.org/geotiff/proj_list/mercator_2sp.html suggests that "ProjStdParallel1GeoKey" should be used for the parallels of true scale and that a scale should not be specified. When given such a geotiff, the normilization code will drop the latitude and generate a scale of 1. This silently mangles the projection.

I will supply a patch to fix this behavior.

Attachments (1)

0002-Support-ProjStdParallel1GeoKey-in-Mercator-projectio.patch (4.3 KB ) - added by tpiepho 10 years ago.
Patch (vs libgeotiff from gdal git)

Download all attachments as: .zip

Change History (6)

comment:1 by warmerdam, 10 years ago

Status: newassigned

I skimmed the code and I see what you mean. I'll attempt to review and apply your patch when I see it.

by tpiepho, 10 years ago

Patch (vs libgeotiff from gdal git)

comment:2 by tpiepho, 10 years ago

Changes to geotiff in patch:

For writing, there are no changes.

For reading, there are some changes. There is no change for geotiffs with 1SP projections, which will be presented in same manner as before. For 2SP there could be a change with applications that do not support 2SP in geotiff.

Current behavior is effectively to silently change the lat_ts value to 0.0, a rather poor outcome. There is no way the app can work correctly.

A possible new behavior is the app will notice ProjScaleAtOriginGeoKey has not been provided and generate a warning or error.

Another possibility is that the app will just use what it thinks should be the scale and get 0.0. This results in an invalid projection, presumably letting the user know their app does not support this geotiff. GDAL does this (I have a patch to fix).

I think both these possibilities are better than the current behavior. And of course an app that supports 2SP can now work correctly. An alternative patch to libgeotiff could calculate a scale value and provide that to the app, allowing non-2SP aware apps to understand the projection. However, I think this isn't a good idea.

  1. The calculation requires some math and the eccentricity of the datum's ellipsoid, which libgeotiff would now have to figure out. And what if the datum is missing? I think this kind of projection math doesn't belong in libgeotiff and should be somewhere higher up, like in PROJ4, which is in fact where it currently exists.
  1. Given both a lat_ts and a scale, how is an application to know which to prefer? Presumably the one specified in the geotiff should be used, rather than the inexact value calculated from it, but which is that?

comment:3 by hobu, 10 years ago

I have applied this patch in r2473. Can you please review Frank?

comment:4 by warmerdam, 10 years ago

Resolution: fixed
Status: assignedclosed

LGTM

comment:5 by rouault, 9 years ago

Complementary ticket: #72 "Mercator_2SP when reading PCS code only"

Note: See TracTickets for help on using tickets.