Skip to content

Commit

Permalink
Fix geod_inverse argument order (#107)
Browse files Browse the repository at this point in the history
Fixes #105
  • Loading branch information
visr authored Jun 16, 2024
1 parent fbff689 commit b112b1f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
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

0 comments on commit b112b1f

Please sign in to comment.