From ac5d9172616385a67552a0cf62ec011df15a8db6 Mon Sep 17 00:00:00 2001 From: Martijn Visser Date: Wed, 2 Oct 2024 23:15:14 +0200 Subject: [PATCH] Wrap PROJ 9.5 --- src/libproj.jl | 50 ++++++++++++++++++++++++++++++++++++++++++++++++- test/libproj.jl | 7 +++---- 2 files changed, 52 insertions(+), 5 deletions(-) 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 04a0f5c..7c49d06 100644 --- a/test/libproj.jl +++ b/test/libproj.jl @@ -457,7 +457,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(), @@ -466,7 +466,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") @@ -497,8 +497,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