1

I have chosen to use a Web Mercator projection system for:

  1. Use of Tiling system for low memory usage
  2. Accessing only one site/area at a time
  3. Reuse of Google Tiles - for many sites

In some cases I will use high resolution UTM images, projected onto the tiled Web Mercator user interface. I suspect it is due to Easting distortion increasing in severity at greater distances from the central meridian.

see Calculating areal distortion outside UTM zone?

This is inaccessible to me as a Software Engineer with inadequate experience in GIS. Needing:

  1. To know if that linked answer has the full capability for my situation
  2. To know how to represent that as two Pseudo code functions: i) Point GeoToUTMPoint(Point Geo); and ii) Point UTMToGeoPoint(Point UTM).

Google Maps Reference UTM Tiled in my App

You need to download the images and toggle between them to see the distortion. The site here is in Geelong, Australia with UTM Zone 55S. Markers placed on the map (see second UTM Tiled image) and have an assumed Geo-Coordinate. When those are placed in Google Maps there is an offset error. The top left and bottom right are quite stable, areas to the top right and bottom left increasingly shift the coordinates generally anti-clockwise but moreso shearing than fully rotating.

I know there's a reason Web Mercator is resisted being non-conformal. But I'm hoping there are some here who can at least point me in the right direction with a few pseudo code functions that I can use together.

I'll pay for the answer and keep it published for all: https://www.upwork.com/jobs/Function-for-Correcting-Distortions-from-UTM-Projection_~01661dc8f1a19fbb8c. If you want the money you need to prove you answered it of course, which can happen if you publishing a code (I supply from upwork chat) in a comment with your same StackExchange alias.

  • Perhaps that distortion answer I quoted is either incorrect or too complicated for my needs. I just chatted to someone who was aware of a function for convergence. Anyone agree? – Todd Feb 25 '16 at 5:06
  • Re: Convergence - perhaps this answer is in the right direction? gis.stackexchange.com/a/147527/67858 – Todd Feb 25 '16 at 5:11
  • I tried the following and got result 1.628degrees which looks valid - wolframalpha.com/input/… – Todd Feb 25 '16 at 5:33
  • Or using the function which uses arcsin (rather than arctan) gives the result 2.071 degrees - wolframalpha.com/input/… – Todd Feb 25 '16 at 5:53
  • Which one is correct? The function with acrtan or arcsin? And what do I do with the output to determine the correction to determine the correct Geo coordinate? – Todd Feb 25 '16 at 5:55
0

I don't know if you need to implement this distortion correction Calculating areal distortion outside UTM zone? specifically. There are open source solutions to perform the conversion you asked for in your need #2: i) Point GeoToUTMPoint(Point Geo); and ii) Point UTMToGeoPoint(Point UTM). Here is one project in Javascript for lat/lon to UTM and vice versa.

For lat/lon to spherical mercator (web mercator) take a look at https://github.com/mapbox/node-sphericalmercator.

0

If the correct site boundary geo-coordinates are known and used to supply tiles, you'll find the top left and bottom right will have no distortion.

(When using such a TMS projection system designed for Web Mercator, you can't mix static UTM images with TMS Tiles.)

Because the correct boundaries are known you can use the same technique used for the tiles to also get the correct geo-coordinates. A user-input click yields a coordinate from the mapping control, with that coordinate you can find the ratio of the position relative to the image boundaries.

Then because you also know the UTM boundaries (in metres) you can deduce the Easting/Northing of the false supplied geo-coordinate, and then use a standard algorithm to convert from UTM Transversal to WGS84 Web Mercator Geo-coordinate.

Trust me, it worked for me after many hours of trying everything. I'm not saying that mixing UTM with a Web Mercator TMS system is a great idea, but it can be made to work, mainly with ratios.

Here's my C# source code for going in one direction:

private GeoPoint MapToGeo(Location location)
{
    //Top left is considered the origin

    //Geodetic boundaries and metrics of image
    var mapImageGetTopLeft = _SiteImage.GeoTopLeft;
    var mapImageGeoBottomRight = _SiteImage.GeoBottomRight;
    var mapImageGeoWidth = mapImageGeoBottomRight.Longitude - mapImageGetTopLeft.Longitude;
    var mapImageGeoHeight = mapImageGeoBottomRight.Latitude - mapImageGetTopLeft.Latitude;

    //Input point's offset from the origin
    Trace.WriteLine(string.Format("Before: http://maps.google.com/maps?q=loc:{0},{1}", location.Latitude, location.Longitude)); // new GeoPoint(location2.Latitude, location2.Longitude);
    var GeoWidthProgress = location.Longitude - mapImageGetTopLeft.Longitude;
    var GeoHeightProgress = location.Latitude - mapImageGetTopLeft.Latitude;

    //The magic ratio - this can be applied to both the image pixels or directly to the meters values (if already stored)
    var WidthRatio = GeoWidthProgress / mapImageGeoWidth;
    var HeightRatio = GeoHeightProgress / mapImageGeoHeight;

    //UTM Width and Height
    var mapImageUTMWidth = _SiteImage.EastingBR - _SiteImage.EastingTL;
    var mapImageUTMHeight = _SiteImage.NorthingBR - _SiteImage.NorthingTL;

    //Apply the ratios to the width and height
    var UTMWidthProgress = mapImageUTMWidth * WidthRatio;
    var UTMHeightProgress = mapImageUTMHeight * HeightRatio;

    //Add the UTM origin
    var UTMEasting = UTMWidthProgress + _SiteImage.EastingTL;
    var UTMNorthing = UTMHeightProgress + _SiteImage.NorthingTL;

    //Correction for datums
    UtmPoint utmPoint = new UtmPoint(UTMEasting, UTMNorthing, _SiteImage.ZoneTL, location.Latitude > 0);
    string datum = CurrentSite.Datum;
    // if datum is OSGB36 we need to convert the utmPoint to WGS84
    if (datum.Equals("OSGB36"))
    {
        utmPoint = CoordinateConverter.OSGB36toWGS84(utmPoint);
        datum = "WGS84";
    }

    //Final transversal to geodetic conversion
    GeoPoint finalGeo = CoordinateConverter.UtmToGeo(utmPoint, datum);
    Trace.WriteLine(string.Format("Final: http://maps.google.com/maps?q=loc:{0},{1}", finalGeo.Latitude, finalGeo.Longitude)); // new GeoPoint(location2.Latitude, location2.Longitude);
    return finalGeo;
}

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.