[PROJ] Hodine Oblique Mercator

Andrew Patterson andrew at avenza.com
Thu Dec 16 15:14:46 PST 2021


Even,


> I assume your real original WKT lacks rectified_grid_angle, in which case
> I do reproduce the gamma = 0.
>
Yes. I'm not sure what it is about posting to this list that makes me
incapable of copy & pasting the right thing, but yes, you're 100% right.

This was the WKT I meant to post, not that it matters now

PROJCS["NAD_1983_Michigan_GeoRef_Meters",GEOGCS["GCS_NAD83(1986)",DATUM["North_American_Datum_1983",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Hotine_Oblique_Mercator"],PARAMETER["false_easting",2546731.496],PARAMETER["false_northing",-4354009.816],PARAMETER["latitude_of_center",45.30916666666666],PARAMETER["longitude_of_center",-86],PARAMETER["azimuth",-22.74444],PARAMETER["scale_factor",0.9996],UNIT["Meter",1]]


> The WKT importer of PROJ (used by GDAL 3) has logic in
> https://github.com/OSGeo/PROJ/blob/master/src/iso19111/io.cpp#L3578 to
> use the azimuth values as the angle to skew grid (+gamma) when it is
> missing, which is the case in ESRI WKT. But your above WKT, which looks
> strongly like ESRI WKT, uses "Hotine_Oblique_Mercator" which isn't a ESRI
> projection name (they use different variants), so it takes a different road
> which doesn't do the same handling of missing rectified_grid_angle. But it
> should. I've just fixed this per https://github.com/OSGeo/PROJ/pull/2985
>
I appreciate that! I'll cherry pick that into our local PROJ rather than
use my hacky approach. Thanks so very much!


> This isn't necessarily the good way to formulate the question. PROJ 8 is
> in the direct continuity of PROJ 6, with many bugfixes and enhancements.
> For your use case, what matters more is the GDAL version. In GDAL 2.x, GDAL
> had its own logic to parse WKT and transform it to PROJ.4 string, even if
> used with PROJ 6 (by the way GDAL 2.x with PROJ 6 isn't necessarily a
> "vetted" conf. I'd say people should stick at PROJ 5.2 if they used GDAL
> 2.x). GDAL 3 requires PROJ >= 6, which has a WKT import logic completely
> re-written from scratch, , and that GDAL uses (GDAL 3 no longer has a
> built-in WKT parser), so no wonder that there might he differences of
> behavior compared to GDAL 2, although all the effort and testing we put in
> trying to minimize the gaps. You seem to have a good dataset to shake the
> implementation :-)
>
Sorry, I know that PROJ has undergone a fairly big refactor, I wasn't
trying to sound like I was complaining! I've spent enough time in the code
now to grasp the ideas behind it (i.e. pipelines) and I see the power &
flexibility of the approach. The subject matter it's dealing with is a
ridiculously complex one, so I have nothing but sympathy for having things
like this come up. I appreciate you taking the time to look at it.

And yes, we have a fairly good dataset -- the Avenza Maps map store has
some ludicrous number of maps, and since people have been pouring maps into
it for five or six years, generated with a variety of applications, we've
seen a lot of issues in this move of ours. Our problem is that given the
enormous field of maps, the people finding these problems tend to be
customers or vendors, rather than our QA: we've spent a fair bit of time
responding to problems. I suspect this won't be the last time, but as I
said in my first email, I've learned enough from these interactions here to
more quickly drill down to the problem and -- mostly -- eliminate GDAL or
PROJ as the culprit. The handful that slip through will show as emails from
me here like this :)

Thanks again!


> Even
> Le 16/12/2021 à 20:01, Andrew Patterson a écrit :
>
> Hello again!
>
> I'm afraid I'm back with another GDAL 2.x -> GDAL 3.x mystery. I've
> unraveled some of it, but I'm hoping someone can illuminate the rest and
> maybe even suggest a course of action.
>
> We have existing maps in our map store that are using the
> Hotine_Oblique_Mercator projection. They worked fine in GDAL 2.2 (PROJ 6.1)
> but are not working correctly in GDAL 3.3 (PROJ 8.1). They load and
> transform, but whereas the map is of Michigan, with the WKT below it thinks
> the map is in New Mexico. The WKT in question is:
>
>
> PROJCS["NAD_1983_Michigan_GeoRef_Meters",GEOGCS["GCS_NAD83(1986)",DATUM["North_American_Datum_1983",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Hotine_Oblique_Mercator"],PARAMETER["false_easting",2546731.496],PARAMETER["false_northing",-4354009.816],PARAMETER["latitude_of_center",45.30916666666666],PARAMETER["longitude_of_center",-86],PARAMETER["azimuth",-22.74444],PARAMETER["rectified_grid_angle",-22.74444],PARAMETER["scale_factor",0.9996],UNIT["Meter",1]]
>
> Having learned something from the last time this list assisted me, I
> checked the proj4 string in 2.4 vs 3.3 and it revealed a difference:
>
> GDAL 2.4/ PROJ 6.1:
> +proj=omerc +no_uoff +lat_0=45.30916666666666 +lonc=-86 +alpha=-22.74444
> +k=0.9996 +x_0=2546731.496 +y_0=-4354009.816 +datum=NAD83 +units=m +no_defs
>
> GDAL 3.3/PROJ 8.1:
> +proj=omerc +no_uoff +lat_0=45.3091666666667 +lonc=-86 +alpha=-22.74444
> +k=0.9996 +x_0=2546731.496 +y_0=-4354009.816 +datum=NAD83 +units=m +no_defs
> +gamma=0
>
> The difference is, clearly, the "+gamma=0". If I remove that and import
> the string, instead of the above WKT, it works. If I then export it to WKT,
> it adds a parameter:
>
> PARAMETER["rectified_grid_angle",-22.74444]
>
> This appears to be set to the same value as the "azimuth" parameter. So
> currently I have a hack where if I see a "Hotine_Oblique_Mercator"
> projection that has an "azimuth" parameter but no "rectified_grid_angle", I
> add "rectified_grid_angle" and set its value to the same as the "azimuth"
> parameter. This feels a bit sketchy, but maybe that is the best solution.
>
> So I guess what I'm asking is: IS that the best solution? What changed
> from PROJ 6.1 to PROJ 8.1 that caused this? I need to support these older
> maps somehow, so I'd love some guidance as to what a 'safe' hack is if
> possible.
>
> Any help would be greatly appreciated!
>
> ..............................
> Andrew Patterson
> Lead Software Architect
> Avenza Systems Inc.
>
> email: andrew at avenza.com
> phone: 416.487.5116
>
> _______________________________________________
> PROJ mailing listPROJ at lists.osgeo.orghttps://lists.osgeo.org/mailman/listinfo/proj
>
> -- http://www.spatialys.com
> My software is free, but my time generally not.
>
>

-- 
..............................
Andrew Patterson
Lead Software Architect
Avenza Systems Inc.

email: andrew at avenza.com
phone: 416.487.5116
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/proj/attachments/20211216/7d6a840b/attachment-0001.html>


More information about the PROJ mailing list