2

I am computing the distance of a map I am getting from ArcGIS' REST services by using a calculator as provided by this answer. In a nutshell, it uses a GeodeticCalculator for distance computation based on latitude and longitude.

I then use the distance and my display width to compute a scale. My display is currently 362*230 (custom display hence the off measurements). When comparing the distances on screen to the distances as given by Google maps, the measurement always overestimated. However, it did so by a factor of roughly 1.2. I not use this as a correction coefficient and am accurate to about 1m in 1 km.

While this solution works (for now), I would like to know where this offset could come from. Below is a bit of code to show how the computation is done. Note that scale is a field of the class this method resides in.

/** Relevant fields */
private GeodeticCalculator calculator = new GeodeticCalculator(CRS.decode("EPSG:3857"));
private static final double CORRECTION = 1.2;

/** More code left out for reasons of brevity. */

public double computeScale(double latMin, double latMax, double lonMin, double lonMax)
{           
    calculator.setStartingPosition(new DirectPosition2D(latMin, lonMin));
    calculator.setDestinationPosition(new DirectPosition2D(latMax, lonMax));        
    double distance = calculator.getOrthodromicDistance();
    scale = distance / (Calibration.getTableWidth() / 10) / CORRECTION;
    return distance;
}
Eric
  • 168
  • 2
  • 10

0 Answers0