io related tests.
Bases: unittest.case.TestCase
Tests for reading and writing of raster and vector data.
Multiband rasters can be read and written correctly
SQLite vector data can be read and written correctly
3D polygons can be read correctly with z component dismissed
3D polygons are a specialisation of ‘2d’ polygons which assigns a ‘z’ to each vertex (wkbPolygon25D in ogr parlance). It’s normally referred to as 2.5D since the format does not truly represent volumetric spaces
This test verifies that such polygons can be read as 2d - i.e. with the third dimension removed.
ogrinfo reports this for 25d polygons:
INFO: Open of `../inasafe_data/test/25dpolygon.shp'
using driver `ESRI Shapefile' successful.
1: 25dpolygon (3D Polygon)
Conversion to wkt data works
ASC raster files with bad data causes good error message
This example is courtesy of Hyeuk Ryu
Centroid point data can be derived from polygon data
Test against centroid data generated by QGIS: shapefiles with a _centroids.shp suffix.
Projections that are compatible but not identical are recognised
This is a test for issue #304
Bounding box is correctly extracted from file.
Reference data:
gdalinfo Earthquake_Ground_Shaking_clip.tif
Driver: GTiff/GeoTIFF
Files: Earthquake_Ground_Shaking_clip.tif
Size is 345, 263
Coordinate System is:
GEOGCS["WGS 84",
DATUM["WGS_1984",
SPHEROID["WGS 84",6378137,298.2572235630016,
AUTHORITY["EPSG","7030"]],
AUTHORITY["EPSG","6326"]],
PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433],
AUTHORITY["EPSG","4326"]]
Origin = (99.364169565217395,-0.004180608365019)
Pixel Size = (0.008339130434783,-0.008361216730038)
Metadata:
AREA_OR_POINT=Point
TIFFTAG_XRESOLUTION=1
TIFFTAG_YRESOLUTION=1
TIFFTAG_RESOLUTIONUNIT=1 (unitless)
Image Structure Metadata:
COMPRESSION=LZW
INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( 99.3641696, -0.0041806)
( 99d21'51.01"E, 0d 0'15.05"S)
Lower Left ( 99.3641696, -2.2031806)
( 99d21'51.01"E, 2d12'11.45"S)
Upper Right ( 102.2411696, -0.0041806)
(102d14'28.21"E, 0d 0'15.05"S)
Lower Right ( 102.2411696, -2.2031806)
(102d14'28.21"E, 2d12'11.45"S)
Center ( 100.8026696, -1.1036806)
(100d48'9.61"E, 1d 6'13.25"S)
Band 1 Block=256x256 Type=Float64, ColorInterp=Gray
Vector and Raster objects can be instantiated with None
Ordering of polygon vertices is preserved when writing and reading
Raster layers can be converted to vector point layers (real data)
# See qgis project in test data: raster_point_and_clipping_test.qgs
Rasters can be created from arrays in projected coordinates
Rasters can be read and written correctly in different formats
Vector line data can be read and written correctly
Vector point data can be read and written correctly
Vector polygon data can be read and written correctly