UrbanCentre
urban_centres.raster_uc.UrbanCentre(self, path, exp_ext=['.tif', '.tiff', '.tff'])
Object to create and store urban centres.
Parameters
Name | Type | Description | Default |
---|---|---|---|
path |
Union[str, pathlib.Path] | Path to the raw raster file | required |
exp_ext |
list | List of acceptable raster file extensions, defaults to [“.tif”, “.tiff”, “.tff”]. | ['.tif', '.tiff', '.tff'] |
Attributes
Name | Type | Description |
---|---|---|
file | Union[str, pathlib.Path] | Path to the raw raster file. |
aff | affine.Affine | Affine transform matrix for the raster file. |
crs | rasterio.crs.CRS | CRS string for the raster. |
output | gpd.GeoDataFrame | GeoDataFrame including vector information for the urban centre, buffer and bounding box limits. |
Raises
Type | Description |
---|---|
TypeError | When file is not either of string or pathlib.Path. |
FileNotFoundError | When file does not exist on disk. |
ValueError | When file does not have the expected file extension(s). |
Notes
Intermediate results for the urban centre calculations are stored as internal (mangled) attributes, but can be accessed for examination.
Methods
Name | Description |
---|---|
get_urban_centre | Get urban centre. |
get_urban_centre
urban_centres.raster_uc.UrbanCentre.get_urban_centre(bbox, centre, centre_crs=None, band_n=1, cell_pop_threshold=1500, diag=False, cluster_pop_threshold=50000, cell_fill_threshold=5, vector_nodata=-200, buffer_size=10000, buffer_estimation_crs='EPSG:27700')
Get urban centre.
Wrapper for functions to get urban centre, buffer and bbox.
Parameters
Name | Type | Description | Default |
---|---|---|---|
bbox |
gpd.GeoDataFrame | A GeoPandas GeoDataFrame containing boundaries to filter the raster. If the boundaries are a bounding box, the raster is clipped to the box. If it is an irregular shape (e.g. LA boundaries) the raster is clipped to the extent of the shape, and a mask is applied to the shape. | required |
centre |
tuple | Tuple with coordinates for city centre. Urban centres that do not contain these coordinates will be filtered out. | required |
centre_crs |
str | crs string of the centre coordinates. If None, it will default to raster_crs. | None |
band_n |
int | Band number to load from the geoTIFF. | 1 |
cell_pop_threshold |
int | When calculating urban centre, keep cells whose value is equal or higher than the threshold. | 1500 |
diag |
bool | When calculating clusters, if True, diagonals are considered as adjacent and included in the cluster. | False |
cluster_pop_threshold |
int | Threshold to consider inclusion of cluster. If total population in cluster is lower than threshold, the cluster label is filtered out. | 50000 |
cell_fill_threshold |
int | Defines gap filling behaviour. If the number of cells adjacent to any empty cell belonging to a cluster is higher than the threshold, the cell is filled with the cluster value. Needs to be between 5 and 8. | 5 |
vector_nodata |
int | Value to fill empty cells. Select a negative value that you would not expect to encounter within the raster population data. | -200 |
buffer_size |
int | Size of the buffer around the urban centre, in the distance units of the centre_crs . Defaults to 10,000 metres. |
10000 |
buffer_estimation_crs |
string | CRS to use when calculating the buffer. Recommend using an appropriate CRS for measuring distances. Default is “EPSG:27700”, suitable for UK urban centres. See Notes for more details. | 'EPSG:27700' |
Returns
Type | Description |
---|---|
gpd.GeoDataFrame | GeoDataFrame with urban centre, buffer and bbox vector polygon boundaries. |
Notes
Buffer estimation: To detemine a buffer around the urban centre an appropriate CRS is needed to ensure distances are preserved. The CRSs adopted for raster data typically preserve area (e.g., Mollweide/ ESRI:54009 is an equal area projection). The solution to this problem would be to provide an appropriate CRS to use when estimating the buffer geometry, such as those used for topographic mapping and engineering surveying of specific countries. To date, the following CRS have been utilised for their respective countries when estimating buffers around urban centres:
Country | CRS |
---|---|
UK | EPSG:27700 |
France | EPSG:2154 |