Skip to content

Commit

Permalink
Wrap and require PROJ 9.5 (#108)
Browse files Browse the repository at this point in the history
* Require PROJ 9.4

* Wrap PROJ 9.5
  • Loading branch information
visr authored Oct 9, 2024
1 parent b596c9b commit 9768d37
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 8 deletions.
8 changes: 5 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "Proj"
uuid = "c94c279d-25a6-4763-9509-64d165bea63e"
version = "1.7.2"
version = "1.8.0"

[deps]
CEnum = "fa961155-64e5-5f13-b03f-caf6b980ea82"
Expand All @@ -11,13 +11,15 @@ NetworkOptions = "ca575930-c2e3-43a9-ace4-1e988b2c1908"
PROJ_jll = "58948b4f-47e0-5654-a9ad-f609743f8632"

[compat]
Aqua = "0.7"
Aqua = "0.8"
CEnum = "0.2, 0.3, 0.4, 0.5"
CoordinateTransformations = "0.6"
GeoFormatTypes = "0.4"
GeoInterface = "1.3"
NetworkOptions = "1"
PROJ_jll = "900.100, 901"
PROJ_jll = "902.500"
StaticArrays = "1"
Test = "<0.0.1, 1"
julia = "1.6"

[extras]
Expand Down
50 changes: 49 additions & 1 deletion src/libproj.jl
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,14 @@ function proj_context_get_user_writable_directory(create, ctx = C_NULL)
)
end

function proj_context_set_user_writable_directory(path, create, ctx = C_NULL)
@ccall libproj.proj_context_set_user_writable_directory(
ctx::Ptr{PJ_CONTEXT},
path::Cstring,
create::Cint,
)::Cvoid
end

function proj_grid_cache_set_enable(enabled, ctx = C_NULL)
@ccall libproj.proj_grid_cache_set_enable(ctx::Ptr{PJ_CONTEXT}, enabled::Cint)::Cvoid
end
Expand Down Expand Up @@ -1958,6 +1966,16 @@ function proj_coordoperation_has_ballpark_transformation(coordoperation, ctx = C
)::Cint
end

function proj_coordoperation_requires_per_coordinate_input_time(
coordoperation,
ctx = C_NULL,
)
@ccall libproj.proj_coordoperation_requires_per_coordinate_input_time(
ctx::Ptr{PJ_CONTEXT},
coordoperation::Ptr{PJ},
)::Cint
end

function proj_coordoperation_get_param_count(coordoperation, ctx = C_NULL)
@ccall libproj.proj_coordoperation_get_param_count(
ctx::Ptr{PJ_CONTEXT},
Expand Down Expand Up @@ -3926,6 +3944,34 @@ function proj_create_conversion_orthographic(
)::Ptr{PJ}
end

function proj_create_conversion_local_orthographic(
center_lat,
center_long,
azimuth,
scale,
false_easting,
false_northing,
ang_unit_name,
ang_unit_conv_factor,
linear_unit_name,
linear_unit_conv_factor,
ctx = C_NULL,
)
@ccall libproj.proj_create_conversion_local_orthographic(
ctx::Ptr{PJ_CONTEXT},
center_lat::Cdouble,
center_long::Cdouble,
azimuth::Cdouble,
scale::Cdouble,
false_easting::Cdouble,
false_northing::Cdouble,
ang_unit_name::Cstring,
ang_unit_conv_factor::Cdouble,
linear_unit_name::Cstring,
linear_unit_conv_factor::Cdouble,
)::Ptr{PJ}
end

function proj_create_conversion_american_polyconic(
center_lat,
center_long,
Expand Down Expand Up @@ -5273,7 +5319,7 @@ end

const PROJ_VERSION_MAJOR = 9

const PROJ_VERSION_MINOR = 4
const PROJ_VERSION_MINOR = 5

const PROJ_VERSION_PATCH = 0

Expand Down Expand Up @@ -5308,6 +5354,8 @@ const PROJ_ERR_COORD_TRANSFM_GRID_AT_NODATA = PROJ_ERR_COORD_TRANSFM + 5

const PROJ_ERR_COORD_TRANSFM_NO_CONVERGENCE = PROJ_ERR_COORD_TRANSFM + 6

const PROJ_ERR_COORD_TRANSFM_MISSING_TIME = PROJ_ERR_COORD_TRANSFM + 7

const PROJ_ERR_OTHER = 4096

const PROJ_ERR_OTHER_API_MISUSE = PROJ_ERR_OTHER + 1
Expand Down
7 changes: 3 additions & 4 deletions test/libproj.jl
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ end
)
@test GFT.WellKnownText2(crs) == GFT.WellKnownText2{GFT.CRS}(
GFT.CRS(),
"GEOGCRS[\"WGS 84\",\n ENSEMBLE[\"World Geodetic System 1984 ensemble\",\n MEMBER[\"World Geodetic System 1984 (Transit)\"],\n MEMBER[\"World Geodetic System 1984 (G730)\"],\n MEMBER[\"World Geodetic System 1984 (G873)\"],\n MEMBER[\"World Geodetic System 1984 (G1150)\"],\n MEMBER[\"World Geodetic System 1984 (G1674)\"],\n MEMBER[\"World Geodetic System 1984 (G1762)\"],\n MEMBER[\"World Geodetic System 1984 (G2139)\"],\n ELLIPSOID[\"WGS 84\",6378137,298.257223563,\n LENGTHUNIT[\"metre\",1]],\n ENSEMBLEACCURACY[2.0]],\n PRIMEM[\"Greenwich\",0,\n ANGLEUNIT[\"degree\",0.0174532925199433]],\n CS[ellipsoidal,2],\n AXIS[\"geodetic latitude (Lat)\",north,\n ORDER[1],\n ANGLEUNIT[\"degree\",0.0174532925199433]],\n AXIS[\"geodetic longitude (Lon)\",east,\n ORDER[2],\n ANGLEUNIT[\"degree\",0.0174532925199433]],\n USAGE[\n SCOPE[\"Horizontal component of 3D system.\"],\n AREA[\"World.\"],\n BBOX[-90,-180,90,180]],\n ID[\"EPSG\",4326]]",
"GEOGCRS[\"WGS 84\",\n ENSEMBLE[\"World Geodetic System 1984 ensemble\",\n MEMBER[\"World Geodetic System 1984 (Transit)\"],\n MEMBER[\"World Geodetic System 1984 (G730)\"],\n MEMBER[\"World Geodetic System 1984 (G873)\"],\n MEMBER[\"World Geodetic System 1984 (G1150)\"],\n MEMBER[\"World Geodetic System 1984 (G1674)\"],\n MEMBER[\"World Geodetic System 1984 (G1762)\"],\n MEMBER[\"World Geodetic System 1984 (G2139)\"],\n MEMBER[\"World Geodetic System 1984 (G2296)\"],\n ELLIPSOID[\"WGS 84\",6378137,298.257223563,\n LENGTHUNIT[\"metre\",1]],\n ENSEMBLEACCURACY[2.0]],\n PRIMEM[\"Greenwich\",0,\n ANGLEUNIT[\"degree\",0.0174532925199433]],\n CS[ellipsoidal,2],\n AXIS[\"geodetic latitude (Lat)\",north,\n ORDER[1],\n ANGLEUNIT[\"degree\",0.0174532925199433]],\n AXIS[\"geodetic longitude (Lon)\",east,\n ORDER[2],\n ANGLEUNIT[\"degree\",0.0174532925199433]],\n USAGE[\n SCOPE[\"Horizontal component of 3D system.\"],\n AREA[\"World.\"],\n BBOX[-90,-180,90,180]],\n ID[\"EPSG\",4326]]",
)
@test GFT.ESRIWellKnownText(crs) == GFT.ESRIWellKnownText{GFT.CRS}(
GFT.CRS(),
Expand All @@ -476,7 +476,7 @@ end
@test GFT.ProjString(crs) ==
GFT.ProjString("+proj=longlat +datum=WGS84 +no_defs +type=crs")
@test GFT.ProjJSON(crs) == GFT.ProjJSON(
"{\n \"\$schema\": \"https://proj.org/schemas/v0.7/projjson.schema.json\",\n \"type\": \"GeographicCRS\",\n \"name\": \"WGS 84\",\n \"datum_ensemble\": {\n \"name\": \"World Geodetic System 1984 ensemble\",\n \"members\": [\n {\n \"name\": \"World Geodetic System 1984 (Transit)\",\n \"id\": {\n \"authority\": \"EPSG\",\n \"code\": 1166\n }\n },\n {\n \"name\": \"World Geodetic System 1984 (G730)\",\n \"id\": {\n \"authority\": \"EPSG\",\n \"code\": 1152\n }\n },\n {\n \"name\": \"World Geodetic System 1984 (G873)\",\n \"id\": {\n \"authority\": \"EPSG\",\n \"code\": 1153\n }\n },\n {\n \"name\": \"World Geodetic System 1984 (G1150)\",\n \"id\": {\n \"authority\": \"EPSG\",\n \"code\": 1154\n }\n },\n {\n \"name\": \"World Geodetic System 1984 (G1674)\",\n \"id\": {\n \"authority\": \"EPSG\",\n \"code\": 1155\n }\n },\n {\n \"name\": \"World Geodetic System 1984 (G1762)\",\n \"id\": {\n \"authority\": \"EPSG\",\n \"code\": 1156\n }\n },\n {\n \"name\": \"World Geodetic System 1984 (G2139)\",\n \"id\": {\n \"authority\": \"EPSG\",\n \"code\": 1309\n }\n }\n ],\n \"ellipsoid\": {\n \"name\": \"WGS 84\",\n \"semi_major_axis\": 6378137,\n \"inverse_flattening\": 298.257223563\n },\n \"accuracy\": \"2.0\",\n \"id\": {\n \"authority\": \"EPSG\",\n \"code\": 6326\n }\n },\n \"coordinate_system\": {\n \"subtype\": \"ellipsoidal\",\n \"axis\": [\n {\n \"name\": \"Geodetic latitude\",\n \"abbreviation\": \"Lat\",\n \"direction\": \"north\",\n \"unit\": \"degree\"\n },\n {\n \"name\": \"Geodetic longitude\",\n \"abbreviation\": \"Lon\",\n \"direction\": \"east\",\n \"unit\": \"degree\"\n }\n ]\n },\n \"scope\": \"Horizontal component of 3D system.\",\n \"area\": \"World.\",\n \"bbox\": {\n \"south_latitude\": -90,\n \"west_longitude\": -180,\n \"north_latitude\": 90,\n \"east_longitude\": 180\n },\n \"id\": {\n \"authority\": \"EPSG\",\n \"code\": 4326\n }\n}",
"{\n \"\$schema\": \"https://proj.org/schemas/v0.7/projjson.schema.json\",\n \"type\": \"GeographicCRS\",\n \"name\": \"WGS 84\",\n \"datum_ensemble\": {\n \"name\": \"World Geodetic System 1984 ensemble\",\n \"members\": [\n {\n \"name\": \"World Geodetic System 1984 (Transit)\",\n \"id\": {\n \"authority\": \"EPSG\",\n \"code\": 1166\n }\n },\n {\n \"name\": \"World Geodetic System 1984 (G730)\",\n \"id\": {\n \"authority\": \"EPSG\",\n \"code\": 1152\n }\n },\n {\n \"name\": \"World Geodetic System 1984 (G873)\",\n \"id\": {\n \"authority\": \"EPSG\",\n \"code\": 1153\n }\n },\n {\n \"name\": \"World Geodetic System 1984 (G1150)\",\n \"id\": {\n \"authority\": \"EPSG\",\n \"code\": 1154\n }\n },\n {\n \"name\": \"World Geodetic System 1984 (G1674)\",\n \"id\": {\n \"authority\": \"EPSG\",\n \"code\": 1155\n }\n },\n {\n \"name\": \"World Geodetic System 1984 (G1762)\",\n \"id\": {\n \"authority\": \"EPSG\",\n \"code\": 1156\n }\n },\n {\n \"name\": \"World Geodetic System 1984 (G2139)\",\n \"id\": {\n \"authority\": \"EPSG\",\n \"code\": 1309\n }\n },\n {\n \"name\": \"World Geodetic System 1984 (G2296)\",\n \"id\": {\n \"authority\": \"EPSG\",\n \"code\": 1383\n }\n }\n ],\n \"ellipsoid\": {\n \"name\": \"WGS 84\",\n \"semi_major_axis\": 6378137,\n \"inverse_flattening\": 298.257223563\n },\n \"accuracy\": \"2.0\",\n \"id\": {\n \"authority\": \"EPSG\",\n \"code\": 6326\n }\n },\n \"coordinate_system\": {\n \"subtype\": \"ellipsoidal\",\n \"axis\": [\n {\n \"name\": \"Geodetic latitude\",\n \"abbreviation\": \"Lat\",\n \"direction\": \"north\",\n \"unit\": \"degree\"\n },\n {\n \"name\": \"Geodetic longitude\",\n \"abbreviation\": \"Lon\",\n \"direction\": \"east\",\n \"unit\": \"degree\"\n }\n ]\n },\n \"scope\": \"Horizontal component of 3D system.\",\n \"area\": \"World.\",\n \"bbox\": {\n \"south_latitude\": -90,\n \"west_longitude\": -180,\n \"north_latitude\": 90,\n \"east_longitude\": 180\n },\n \"id\": {\n \"authority\": \"EPSG\",\n \"code\": 4326\n }\n}",
)

@test GFT.EPSG(crs) == GFT.EPSG("EPSG:4326")
Expand Down Expand Up @@ -507,8 +507,7 @@ end
@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, azi1, s12)
@test_nowarn direct_line = Proj.geod_directline(geod, lat1, lon1, azi1, s12)
@test_nowarn inverse_line = Proj.geod_inverseline(geod, lat1, lon1, lat2, lon2)

@test begin
Expand Down

2 comments on commit 9768d37

@visr
Copy link
Member Author

@visr visr commented on 9768d37 Oct 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/116927

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.8.0 -m "<description of version>" 9768d3714d40531109f9bb6f9c4ae6d0839d4eec
git push origin v1.8.0

Please sign in to comment.