-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8d6f670
commit b614376
Showing
2 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using NaturalEarth | ||
using Test | ||
|
||
using Rasters, DimensionalData | ||
import Proj | ||
|
||
@testset "construction" begin | ||
# fetch land polygons from Natural Earth | ||
land_polygons = NaturalEarth.naturalearth("admin_0_countries", 110).geometry | ||
# create a DimVector from the land polygons | ||
gl = GeometryLookup(land_polygons) | ||
@test crs(gl) == EPSG(4326) | ||
@test all(GO.equals, zip(val(gl), land_polygons)) | ||
end | ||
|
||
@testset "reprojecting a GeometryLookup" begin | ||
# fetch land polygons from Natural Earth | ||
land_polygons = NaturalEarth.naturalearth("admin_0_countries", 110).geometry | ||
# create a DimVector from the land polygons | ||
dv = Raster(rand(Dim{:Geometry}(GeometryLookup(land_polygons)))) | ||
# reproject the full vector data cube (vector data vector, in this case :D) | ||
target_crs = ProjString("+proj=wintri +type=crs") | ||
reprojected_via_rasters = val(dims(reproject(target_crs, dv), Dim{:Geometry})) | ||
reprojected_via_geometryops = GO.reproject(land_polygons; source_crs = EPSG(4326), target_crs = target_crs) | ||
# test that the reprojected geometries are the same | ||
@test all(splat(GO.equals), zip( | ||
reprojected_via_rasters, # reproject the vdc, get the geometries from it | ||
reprojected_via_geometryops # reproject the geometries directly | ||
) | ||
) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters