Skip to content

Commit

Permalink
Wrap PROJ 9.5
Browse files Browse the repository at this point in the history
  • Loading branch information
visr committed Oct 2, 2024
1 parent 9f641f5 commit ac5d917
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 5 deletions.
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(

Check warning on line 327 in src/libproj.jl

View check run for this annotation

Codecov / codecov/patch

src/libproj.jl#L326-L327

Added lines #L326 - L327 were not covered by tests
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(

Check warning on line 1969 in src/libproj.jl

View check run for this annotation

Codecov / codecov/patch

src/libproj.jl#L1969

Added line #L1969 was not covered by tests
coordoperation,
ctx = C_NULL,
)
@ccall libproj.proj_coordoperation_requires_per_coordinate_input_time(

Check warning on line 1973 in src/libproj.jl

View check run for this annotation

Codecov / codecov/patch

src/libproj.jl#L1973

Added line #L1973 was not covered by tests
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(

Check warning on line 3947 in src/libproj.jl

View check run for this annotation

Codecov / codecov/patch

src/libproj.jl#L3947

Added line #L3947 was not covered by tests
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(

Check warning on line 3960 in src/libproj.jl

View check run for this annotation

Codecov / codecov/patch

src/libproj.jl#L3960

Added line #L3960 was not covered by tests
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 @@ -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(),
Expand All @@ -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")
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ac5d917

Please sign in to comment.