Geodot Plugin
|
#include <geodata.h>
Public Member Functions | |
bool | is_valid () |
Returns true if the layer could successfully be loaded. | |
bool | has_write_access () |
Returns true for read-write-access and false for read-only-access. | |
Dictionary | get_file_info () |
int | get_epsg_code () |
Returns the spatial reference of the underlying dataset. | |
Image::Format | get_format () |
Returns the Image format which corresponds to the data within this raster layer. | |
int | get_band_count () |
Get the total amount of raster bands contained in the layer. Returns 0 if layer is not valid. More... | |
Array | get_band_descriptions () |
Returns the descriptions of the individual raster bands as strings in an array. | |
Ref< GeoDataset > | get_dataset () |
Ref< GeoRasterLayer > | clone () |
Ref< GeoImage > | get_image (double top_left_x, double top_left_y, double size_meters, int img_size, GeoImage::INTERPOLATION interpolation_type) |
Ref< GeoImage > | get_band_image (double top_left_x, double top_left_y, double size_meters, int img_size, GeoImage::INTERPOLATION interpolation_type, int band_index) |
float | get_value_at_position (double pos_x, double pos_y) |
float | get_value_at_position_with_resolution (double pos_x, double pos_y, double pixel_size_meters) |
void | set_value_at_position (double pos_x, double pos_y, Variant value) |
void | smooth_add_value_at_position (double pos_x, double pos_y, double summand, double radius) |
void | overlay_image_at_position (double pos_x, double pos_y, Ref< Image > image, double scale) |
Rect2 | get_extent () |
Returns the extent of the layer in projected meters (assuming it is rectangular). | |
Vector3 | get_center () |
float | get_min () |
float | get_max () |
float | get_pixel_size () |
Returns the length of a side of a pixel in the dataset, in meters. | |
void | load_from_file (String file_path, bool write_access) |
Load a raster dataset file such as a GeoTIFF into this object. | |
void | set_native_dataset (std::shared_ptr< NativeDataset > new_dataset) |
void | set_origin_dataset (Ref< GeoDataset > dataset) |
Public Attributes | |
bool | write_access |
String | name |
Static Protected Member Functions | |
static void | _bind_methods () |
A layer which contains raster data. Corresponds to a Raster GDALDataset or Subdataset. Its name
property is either the layer name, or the full path if it wasn't opened from a dataset (i.e. get_dataset() returns null).
Ref< GeoRasterLayer > godot::GeoRasterLayer::clone | ( | ) |
Returns a clone of this layer which points to the same file, but uses a different object to access it. This is required when using the same layer in multiple threads.
int godot::GeoRasterLayer::get_band_count | ( | ) |
Get the total amount of raster bands contained in the layer. Returns 0 if layer is not valid.
Ref< GeoImage > godot::GeoRasterLayer::get_band_image | ( | double | top_left_x, |
double | top_left_y, | ||
double | size_meters, | ||
int | img_size, | ||
GeoImage::INTERPOLATION | interpolation_type, | ||
int | band_index | ||
) |
Like get_image but only returns the GeoImage of a single Band. Useful for datasets with many bands which are interpreted in an unusual way (i.e. not RGB(A)).
Vector3 godot::GeoRasterLayer::get_center | ( | ) |
Returns the point in the center of the layer in projected meters. The y-component is 0.0.
Ref< GeoDataset > godot::GeoRasterLayer::get_dataset | ( | ) |
Returns the dataset which this layer was opened from or null
if it was opened directly, e.g. from a GeoTIFF.
Dictionary godot::GeoRasterLayer::get_file_info | ( | ) |
Returns information about this file: is_subdataset
: true if this layer is part of a larger dataset (e.g. a GeoPackage) and not a single file (e.g. a GeoTIFF). path
: the path to the underlying dataset (e.g. the GeoTIFF, or the GeoPackage which this layer was opened from). name
: the name of the layer (if is_subdataset
is true) or the name of the file (otherwise).
Ref< GeoImage > godot::GeoRasterLayer::get_image | ( | double | top_left_x, |
double | top_left_y, | ||
double | size_meters, | ||
int | img_size, | ||
GeoImage::INTERPOLATION | interpolation_type | ||
) |
Returns a GeoImage corresponding to the given position and size. The requested section is read from this GeoRasterLayer into that GeoImage, so this operation is costly for large images. (Consider multithreading.)
float godot::GeoRasterLayer::get_max | ( | ) |
Returns the largest value found in the first raster band of the dataset. Note that this requires the dataset to have pre-computed statistics!
float godot::GeoRasterLayer::get_min | ( | ) |
Returns the smallest value found in the first raster band of the dataset. Note that this requires the dataset to have pre-computed statistics!
float godot::GeoRasterLayer::get_value_at_position | ( | double | pos_x, |
double | pos_y | ||
) |
Returns the value in the GeoRasterLayer at exactly the given position. Note that when reading many values from a confined area, it is more efficient to call get_image and read the pixels from there.
float godot::GeoRasterLayer::get_value_at_position_with_resolution | ( | double | pos_x, |
double | pos_y, | ||
double | pixel_size_meters | ||
) |
Returns the value in the GeoRasterLayer at exactly the given position, at the given resolution. This is useful for getting heights which match up with the heights of a lower resolution image which was fetched using get_image
, rather than being as detailed as possible.
void godot::GeoRasterLayer::overlay_image_at_position | ( | double | pos_x, |
double | pos_y, | ||
Ref< Image > | image, | ||
double | scale | ||
) |
Adds the given image to the raster dataset at the given position. Fully opaque values are replaced; values with alpha between 0 and 1 are interpolated between original and new. A scale of 1 assumes that both images have the same resolution per meter; 2 means that one pixel in this image corresponds to two pixels in the dataset. Useful for drawing into datasets with custom brushes, e.g. a pre-defined land-use pattern.
void godot::GeoRasterLayer::set_native_dataset | ( | std::shared_ptr< NativeDataset > | new_dataset | ) |
Set the GDALDataset object for this layer. Must be a valid raster dataset. Not exposed to Godot since Godot doesn't know about GDALDatasets - this is only for internal use.
void godot::GeoRasterLayer::set_origin_dataset | ( | Ref< GeoDataset > | dataset | ) |
Sets the dataset which this layer was opened from. Not exposed to Godot since it should never construct GeoFeatureLayers by hand.
void godot::GeoRasterLayer::set_value_at_position | ( | double | pos_x, |
double | pos_y, | ||
Variant | value | ||
) |
Replaces exactly one pixel at the given position with the given value. The value must correspond to this layer's type (e.g. a float for Float32 images and a Color for RGB images). Useful for modifying datasets on a small scale, e.g. correcting land-use values.
void godot::GeoRasterLayer::smooth_add_value_at_position | ( | double | pos_x, |
double | pos_y, | ||
double | summand, | ||
double | radius | ||
) |
Adds the given summand to the previous value at the given position and smoothly cross-fades into the original data along the given radius. Useful for terraforming terrain, e.g. creating a new hill with smooth slopes.