Read the documentation of VRT https://gdal.org/drivers/raster/vrt.html and add color table. Step by step example:
Create test image with gdal_create https://gdal.org/programs/gdal_create.html#gdal-create. Utility is included in GDAL version 3.2 and higher.
gdal_create -of GTiff -outsize 10 10 -bands 1 -burn 2 -ot Float32 float_gray.tif
Create a VRT from ...
The easiest way of rasterizing that shapefile's biome field to a global raster longlat layer of a 1 x 1 degree resolution is probably the following:
# Load packages
packs <- list("tidyverse", "raster", "sf", "fasterize")
lapply(packs, require, character.only = T)
# Load shapefile
wwf_shp <- st_read("C:/...
Each of you geometries is within a list, so you are effectively passing a list of lists as a geometry to GeoDataFrame. You have to pass a list-like of geometries, not lists.
Using apply you can get the actual geometry out of the list.
b = gpd.GeoDataFrame(a[['a', 'b']], geometry=a['c'].apply(lambda x: x)
The query below creates a linestring from the multilinestring provied.
from ST_Dump(ST_GeomFromText('MULTILINESTRING((-3.16420835153456 55.9269166007097,-3.164222 55.926918),(-3.1642070167833 55.9269296196706,-3.16421351659546 55.9268662214904),
(-3.16421351659546 55.9268662214904,-3.16421636372824 55.9268384509897),(-3....
Easy Python solution for you. Only requires the installation of GeoPandas. Just substitute your filepaths and run this script.
inputFile = '/home/lpowalka/Documents/dane/prg/Województwa_pop.shp'
outputFile = '/home/lpowalka/Documents/dane/prg/Województwa_pop_new.shp'
df = geopandas.read_file(inputFile)
zfactor = 0.3048
df.geometry = df....
Thanks @Johan, your code is very usefully.
I need to find the EPSG id for utm zone, given latitude and longitude :
# Special zones for Svalbard and Norway
def getZones(longitude, latitude) :
if (latitude >= 72.0 and latitude < 84.0 ) :
if (longitude >= 0.0 and longitude < 9.0) :
return 31 ...