From 9768d3714d40531109f9bb6f9c4ae6d0839d4eec Mon Sep 17 00:00:00 2001 From: Martijn Visser Date: Wed, 9 Oct 2024 21:47:28 +0200 Subject: [PATCH] Wrap and require PROJ 9.5 (#108) * Require PROJ 9.4 * Wrap PROJ 9.5 --- Project.toml | 8 +++++--- src/libproj.jl | 50 ++++++++++++++++++++++++++++++++++++++++++++++++- test/libproj.jl | 7 +++---- 3 files changed, 57 insertions(+), 8 deletions(-) diff --git a/Project.toml b/Project.toml index e92a547..8913b85 100644 --- a/Project.toml +++ b/Project.toml @@ -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" @@ -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] diff --git a/src/libproj.jl b/src/libproj.jl index 500a28c..479b30a 100644 --- a/src/libproj.jl +++ b/src/libproj.jl @@ -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 @@ -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}, @@ -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, @@ -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 @@ -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 diff --git a/test/libproj.jl b/test/libproj.jl index 7b5424c..38ded83 100644 --- a/test/libproj.jl +++ b/test/libproj.jl @@ -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(), @@ -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") @@ -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