Skip to content

Commit

Permalink
run JuliaFormatter
Browse files Browse the repository at this point in the history
  • Loading branch information
visr committed Aug 30, 2023
1 parent e87b0d1 commit 9534b91
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
17 changes: 12 additions & 5 deletions src/coord.jl
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,19 @@ end
function Transformation(
source_crs::GFT.CoordinateReferenceSystemFormat,
target_crs::GFT.CoordinateReferenceSystemFormat;
always_xy::Bool=false,
direction::PJ_DIRECTION=PJ_FWD,
area::Ptr{PJ_AREA}=C_NULL,
ctx::Ptr{PJ_CONTEXT}=C_NULL
always_xy::Bool = false,
direction::PJ_DIRECTION = PJ_FWD,
area::Ptr{PJ_AREA} = C_NULL,
ctx::Ptr{PJ_CONTEXT} = C_NULL,
)
return Transformation(CRS(source_crs).pj, CRS(target_crs).pj; always_xy, direction, area, ctx)
return Transformation(
CRS(source_crs).pj,
CRS(target_crs).pj;
always_xy,
direction,
area,
ctx,
)
end

function Transformation(
Expand Down
9 changes: 6 additions & 3 deletions src/crs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,10 @@ Returns a list of matching reference CRS and confidence values (0-100).
- `crs::CRS`: Coordinate reference system
- `auth_name=nothing`: Authority name, or nothing for all authorities (e.g. "EPSG")
"""
function identify(crs::CRS; auth_name=nothing)::Vector{@NamedTuple{crs::CRS, confidence::Int32}}
function identify(
crs::CRS;
auth_name = nothing,
)::Vector{@NamedTuple{crs::CRS, confidence::Int32}}

out_confidence = Ref(Ptr{Cint}(C_NULL))
if isnothing(auth_name)
Expand All @@ -161,8 +164,8 @@ function identify(crs::CRS; auth_name=nothing)::Vector{@NamedTuple{crs::CRS, con
# was a match found?
if pj_list != C_NULL
n = proj_list_get_count(pj_list)
for i in 1:n
crs = CRS(proj_list_get(pj_list, i-1))
for i = 1:n
crs = CRS(proj_list_get(pj_list, i - 1))
confidence = unsafe_load(out_confidence[], i)
push!(list, (; crs, confidence))
end
Expand Down
6 changes: 3 additions & 3 deletions test/libproj.jl
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,15 @@ end
source_crs = GFT.EPSG("EPSG:4326")
target_crs = GFT.EPSG("EPSG:32628")

trans = Proj.Transformation(source_crs, target_crs, always_xy=false)
trans = Proj.Transformation(source_crs, target_crs, always_xy = false)
info = Proj.proj_pj_info(trans.pj)
description1 = unsafe_string(info.definition)

#crs as txt
source_crs = "EPSG:4326"
target_crs = "EPSG:32628"

trans = Proj.Transformation(source_crs, target_crs, always_xy=false)
trans = Proj.Transformation(source_crs, target_crs, always_xy = false)
info = Proj.proj_pj_info(trans.pj)
description2 = unsafe_string(info.definition)

Expand Down Expand Up @@ -484,7 +484,7 @@ end
@test identity[1].confidence == 70
@test length(identity) == 4

identity = Proj.identify(crs; auth_name="EPSG")
identity = Proj.identify(crs; auth_name = "EPSG")
@test GFT.EPSG(identity[1].crs) == GFT.EPSG(4326)
@test identity[1].confidence == 70
end

0 comments on commit 9534b91

Please sign in to comment.