Skip to content

Commit

Permalink
Allow for option to add first point to close coordinate vector
Browse files Browse the repository at this point in the history
  • Loading branch information
natgeo-wong committed Jul 26, 2024
1 parent 26a3cc8 commit d761028
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/georegions/create.jl
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,13 @@ function PolyRegion(
end
end

if lonpt[1] != lonpt[end]
error("$(modulelog()) - The first and last points of the vector of longitude coordinates must be the same")
end

if latpt[1] != latpt[end]
error("$(modulelog()) - The first and last points of the vector of latitude coordinates must be the same")
if (lon[1] != lon[end]) || (lat[1] != lat[end])
if !join
error("$(modulelog()) - The longitude/ latitude coordinates of the first and last points must be the same")
else
lon = vcat(lon,lon[1])
lat = vcat(lat,lat[1])
end
end

N = maximum(latpt); S = minimum(latpt)
Expand Down

0 comments on commit d761028

Please sign in to comment.