Data To Raster¶
Command
¶
Bases: BaseCommand
Source code in back/iarbre_data/management/commands/data_to_raster.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
|
add_arguments(parser)
¶
Add arguments to the command.
Source code in back/iarbre_data/management/commands/data_to_raster.py
95 96 97 98 99 |
|
rasterize_data_across_all_cities(factor_name, height, width, height_out, width_out, transform, transform_out, all_cities_union, grid_size=5, output_dir=None)
¶
Convert Data polygons to a single binary raster across all cities to avoid border effects.
This function rasterizes the geometries of a specified factor across all cities, applies a convolution to aggregate the raster values into larger blocks, and saves the resulting raster to a file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
factor_name | str | Name of the factor to transform to raster. | required |
height | int | Height of the output raster. | required |
width | int | Width of the output raster. | required |
height_out | int | Height of the output raster after convolution. | required |
width_out | int | Width of the output raster after convolution. | required |
transform | Affine | Affine transformation for the factor transformation. | required |
transform_out | Affine | Affine transformation for the raster output. | required |
all_cities_union | GEOSGeometry | GEOSGeometry containing the union of all city geometries. | required |
grid_size | int | Size of the convolution kernel. Defaults to 5. | 5 |
output_dir | str | Directory to save the raster file. Defaults to None. | None |
Returns:
Type | Description |
---|---|
None | None |
Source code in back/iarbre_data/management/commands/data_to_raster.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
|