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

Fix geod_inverse argument order #107

Merged
merged 1 commit into from
Jun 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/geod.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function geod_inverse(g::geod_geodesic, lat1::Real, lon1::Real, lat2::Real, lon2
azi1 = Ref{Cdouble}(NaN)
azi2 = Ref{Cdouble}(NaN)

geod_inverse(Ref(g), lat1, lat2, lon1, lon2, s12, azi1, azi2)
geod_inverse(Ref(g), lat1, lon1, lat2, lon2, s12, azi1, azi2)

return s12[], azi1[], azi2[]
end
Expand Down
11 changes: 9 additions & 2 deletions test/libproj.jl
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ end
# Maybe enable later, based on https://github.com/JuliaGeo/GeoFormatTypes.jl/issues/21
# @test convert(GFT.ProjString, gftcrs) == GFT.ProjString("+proj=longlat +datum=WGS84 +no_defs +type=crs")

# Check that we can round trip CRS/wkt without errors
# Check that we can round trip CRS/wkt without errors
@test GFT.EPSG(Proj.CRS(GFT.WellKnownText(crs))) ==
GFT.EPSG(Proj.CRS(GFT.WellKnownText2(crs)))

Expand All @@ -495,8 +495,10 @@ end
lat1, lon1, lat2, lon2 = 40.64, -73.78, 1.36, 103.99

@test_nowarn geod = Proj.geod_geodesic(6378137, 1 / 298.257223563)
# the azi1 and s12 values were computed directly
azi1, s12 = 3.3057734780176125, 1.534751294051294e7
@test_nowarn direct_line =
Proj.geod_directline(geod, lat1, lon1, 3.3057734780176125, 1.534751294051294e7) # the azi1 and s13 values were computed directly
Proj.geod_directline(geod, lat1, lon1, azi1, s12)
@test_nowarn inverse_line = Proj.geod_inverseline(geod, lat1, lon1, lat2, lon2)

@test begin
Expand All @@ -523,6 +525,11 @@ end
lats, lons = Proj.geod_path(geod, lat1, lon1, lat2, lon2, 2)
lats[1] ≈ lat1 && lats[2] ≈ lat2 && lons[1] ≈ lon1 && lons[2] ≈ lon2
end

@test begin
s12_, azi1_, azi2_ = Proj.geod_inverse(geod, lat1, lon1, lat2, lon2)
s12 ≈ s12_ && azi1 ≈ azi1_
end
end

@testset "GeoInterface" begin
Expand Down