Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve accuracy of to_latlon() #49

Merged
merged 1 commit into from
Aug 22, 2020
Merged

Improve accuracy of to_latlon() #49

merged 1 commit into from
Aug 22, 2020

Conversation

chlxt
Copy link
Contributor

@chlxt chlxt commented Apr 12, 2020

c should be calculated using E_P2 rather _E, refer to USGS 1395

This bug will reduce the accuracy in some cases when converting from UTM X/Y to Lat/Lon, as has been discussed in #36 .

`c` should be calculated using `E_P2` rather `_E`, refer to USGS 1395
@codecov
Copy link

codecov bot commented Aug 22, 2020

Codecov Report

Merging #49 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #49   +/-   ##
=======================================
  Coverage   95.09%   95.09%           
=======================================
  Files           3        3           
  Lines         163      163           
=======================================
  Hits          155      155           
  Misses          8        8           
Impacted Files Coverage Δ
utm/conversion.py 94.96% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ffad1de...17e570c. Read the comment docs.

@Turbo87 Turbo87 changed the title bug fix for conversion from UTM X/Y to Lat/Lon Improve accuracy of to_latlon() Aug 22, 2020
@Turbo87 Turbo87 added the bug label Aug 22, 2020
@Turbo87 Turbo87 merged commit a6c77c4 into Turbo87:master Aug 22, 2020
chris-cooper added a commit to chris-cooper/utm that referenced this pull request Feb 9, 2021
The current implemenation has inaccuracies.  See:
- Turbo87/utm#36
- Turbo87/utm#49

repro:
```
var utm = require("utm");

var originalLatitude = -33.8688
var originalLongitude = 151.2093

const { easting, northing, zoneNum, zoneLetter} = utm.fromLatLon(originalLatitude,originalLongitude);

const { latitude, longitude } = utm.toLatLon(easting, northing, zoneNum, zoneLetter);

console.log(latitude, longitude)
console.log(`lat/lon delta: ${latitude-originalLatitude}:${longitude-originalLongitude}`)

{
  const { easting: easting2, northing: northing2, zoneNum: zoneNum2, zoneLetter: zoneLetter2} = utm.fromLatLon(latitude,longitude);
  console.log(`delta: ${easting - easting2}:${northing-northing2}`);
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants