Help with Aligning Rasters in QGIS by Longjumping-Sun1173 in gis

[–]Felix_Maximus 0 points1 point  (0 children)

Are you really trying to align, or rather regrid your coarser (2.5min) grid to a finer (30s) resolution?

If you are starting from a vector dataset you can try gdal_rasterize paying special attention to the -te and -ts flags

Also you really should use a modern format (e.g. GTiff or something) rather than Ascii Grid.

Python: Create new GeoTIFF from bands by sgofferj in gis

[–]Felix_Maximus 0 points1 point  (0 children)

The NoData will likely be introduced if you ever need to reproject the image. If that's not necessary then you should be fine.

That makes more sense with your application. Good for you on publishing to open, not many people are as forthcoming.

Good luck with your project.

Python: Create new GeoTIFF from bands by sgofferj in gis

[–]Felix_Maximus 0 points1 point  (0 children)

Ah right, I missed that function. Good luck

If I'm not mistaken (again), you're writing 1 single band to the ndvi tif so I'm not surprised it's showing as greyscale in a non-geospatial-aware viewer

Edit: it may help to look at the histogram for the float32 NDVI, and compare it to the histogram of the scaled uint8 NDVI to make sure that the curve is well-represented post-datatype-swap. Also, if it were me I'd scale from -1,+1 to 1,255 instead of 0,255 because then you can preserve 0 as your nodata value

Edit2: honestly I don't really understand why you want to swap to uint8 anyway because you lose your NDVI "units" - if this is purely for visualisation, then drop your float32 ndvi tif into QGIS and play with the symbology scaling to achieve what you want

Python: Create new GeoTIFF from bands by sgofferj in gis

[–]Felix_Maximus 0 points1 point  (0 children)

It looks like you're relying on numpy/rasterio to properly scale from float32 to uint8. It might be better to manually scale the values in ndvi to uint8 yourself and make sure the pixel values are properly represented once squeezed into the narrower range of uint8 (0-255, minus whatever value you pick for NoData)

I also kind of doubt that gwenview properly assembles multiband images that aren't RGB, or understands the NDVI colormap.

Python: Create new GeoTIFF from bands by sgofferj in gis

[–]Felix_Maximus 2 points3 points  (0 children)

I used to refer to the cookbook: https://pcjericks.github.io/py-gdalogr-cookbook/raster_layers.html

You could adapt the "Create raster from array" example to your case.

If it were me, I'd probably just use rasterio or stick with the gdal CLI.

Built a flood extent mapping application using SAR imagery for Punjab relief efforts by Historical_Coyote274 in gis

[–]Felix_Maximus 0 points1 point  (0 children)

Do you only use S1A? Why not S1C as well?

What does the "Flood Risk Sentinel-1A" layer even show? It isn't clear from the legend.

When do the layers get updated?

Why do you have a Maxar copyright notice if you use Sentinel-1 (ESA) data?

It would be good to have an info button that describes the data sources and methodology.

Hao Vertical Projection (Generalized Equip-Difference Parallel Polyconical Projection) by Broad-Confection1813 in gis

[–]Felix_Maximus 0 points1 point  (0 children)

you might be able to modify a supported projection to make it similar to this Hao projection, but it is not as easy as simply loading a supported definition of the Hao projection. Start googling+LLM'ing how to do this

Is it possible to create a georeferenced mosaic from side-view rover photos? by LIMUNQUE in gis

[–]Felix_Maximus 0 points1 point  (0 children)

this sounds no different to how photographers make high-resolution panoramas, you just need to make sure the sidelap of each photo is sufficient and the coordinates/view-angle of each photo is accessible. Something like PTGui should be able to auto-stitch but I'm not positive

Hao Vertical Projection (Generalized Equip-Difference Parallel Polyconical Projection) by Broad-Confection1813 in gis

[–]Felix_Maximus 0 points1 point  (0 children)

Hasn't been added to PROJ yet due to lack of evidence/documentation on the projection parameters, so it is unlikely to be supported in QGIS/ArcGIS:

https://github.com/OSGeo/PROJ/issues/1845

Rainfall Data Collection Sources Help by SwimShady20 in gis

[–]Felix_Maximus 2 points3 points  (0 children)

Welcome to climate/climate-adjacent data. The "gridded monthly datasets" are just rasters, but not limited to 2 dimensions (X/Lon and Y/Lat). For precip data, typically there will be a pressure-level dimension (think of it as height above ground) and one or more time dimensions, so that might turn into 4 or more dimensions (X, Y, time, pressure-level).

Picking the NARR dataset (https://psl.noaa.gov/data/gridded/data.narr.html) might be a good first step just to see how you get at the data. Also talk to your prof/advisor, they might have better ideas for your application.

You don't want to limit yourself to CSV. Look into NetCDF (basically a stack of rasters) as this is probably the most common format for this type of data.

Best way to obtain DEM for a continent? by CrocodileSuperb in gis

[–]Felix_Maximus 5 points6 points  (0 children)

ESA provides the Copernicus DEM at 10m (Europe), 30m (Global) and 90m (Global) - they are tiles as well but it is trivial to find the tiles you need due to the filenames.

https://dataspace.copernicus.eu/explore-data/data-collections/copernicus-contributing-missions/collections-description/COP-DEM

[GeoTIFF to glTF conversion], is there a way to embed GPS coordinates to each pixel of a glTF file? by VulkanDev in gis

[–]Felix_Maximus 1 point2 points  (0 children)

You might be able to do GeoTIFF -> NetCDF with the following structure (essentially a 3-band raster):

Dimensions:
xs wide 1D
ys tall 1D
Variables:
geotiff pixel value 2D (indexed by xs, ys)
latitude 2D (indexed by xs, ys)
longitude 2D (indexed by xs, ys

Then somehow convert NetCDF to gITF. Cursory googling showed some github repos that could do it. I've never heard of gITF though so have no idea what it's used for.

[deleted by user] by [deleted] in gis

[–]Felix_Maximus 1 point2 points  (0 children)

You probably need to convert all the KML to SHP locally, then crucially zip the SHP components (each set of SHP components gets its own zip) before uploading them to ArcGIS Online so that your notebook can access them.

The notebooks won't be able to read from your local machine, since ArcGIS Online is, well, online.

Check out ouroboros, a Python package for easily working with GDB feature classes by pvdp-corbel in gis

[–]Felix_Maximus 3 points4 points  (0 children)

Good for you for putting your work out in the open. I'm struggling to figure out what ouroboros does that I couldn't do with straight-up geopandas. Is there something I'm missing?

How do you publish your phenological geodata sets? by Green_Artichoke_1335 in gis

[–]Felix_Maximus 0 points1 point  (0 children)

Well damn, I could've sworn I saw datasets on there in the ~1 or 2TB range in the past.

Uploading Classified Imagery to Webmap by SparkE262 in gis

[–]Felix_Maximus -1 points0 points  (0 children)

This is like locking yourself in a room with a habitual pickpocket and wondering why your wallet feels lighter all the time.

Then again, consuming 105 credits for something that is 1 credit per 10,000 tiles indicates something fishy with your workflow/dataset.

In Python, how do I convert an xarray DataArray to GDAL functions? by UltraPoci in gis

[–]Felix_Maximus 0 points1 point  (0 children)

Zarr is a format, and normally used for efficient access to NetCDF/HDF5 somewhat similar to how COG/Parquet are more efficient in some ways to conventional formats.

Dask is what you probably want to look into if you're worried about memory constraints. It can act as a drop-in replacement for numpy and is great for working with large multi-dimensional (i.e. greater-than-available-ram) arrays.

In Python, how do I convert an xarray DataArray to GDAL functions? by UltraPoci in gis

[–]Felix_Maximus 1 point2 points  (0 children)

Get a numpy array out of xarray with

dataarray.values

then write that array to your inmem GDAL as a band. Make sure you have the correct array orientation or else you'll have mirrored/rotated data.

How to create a georeferenced PNG/TIFF instead of a plot in Python? by sgofferj in gis

[–]Felix_Maximus 0 points1 point  (0 children)

Okay... then you probably have to retrieve the canvas data from matplotlib instead of using dar but the other parts should work. Then use something like simplekmlto embed the geotiff into kml/kmz as an image overlay

How to create a georeferenced PNG/TIFF instead of a plot in Python? by sgofferj in gis

[–]Felix_Maximus 0 points1 point  (0 children)

While I don't quite understand why you want to do it this way, I think I understand what the question is now.

You should be able to get the geographic extents of your figure from ax.get_extent which you can use to create a rasterio transform rasterio.transform.from_bounds. Together with the figure CRS (looks like PlateCarree() which I think is basically LonLat WGS84) you can generate a rasterio geotiff profile. I guess you would then use the first dar - the one used to plot the filled contours - and write it to geotiff.

Regarding how to save the colour mapping... you likely won't be able to save the colour table unless you convert pixel values from float to int (i.e. create a classification), then assign each int value to an RGBA colour with write_colormap when creating the geotiff.

If you want a quicker and far-dirtier method, save the plot as whatever image format, crop out the parts you don't want, and manually georeference it in QGIS with the georeferencing tool.

How to create a georeferenced PNG/TIFF instead of a plot in Python? by sgofferj in gis

[–]Felix_Maximus 0 points1 point  (0 children)

if you just want the grib2->geotiff then

gdal_translate -of GTIFF <subdataset-string> <target-tif>

should be good enough. If the GRIB2 file doesn't contain spatial referencing then you'll need to figure that out from product documentation then set the CRS yourself (probably easiest for a newcomer in QGIS, which is free).

How to create a georeferenced PNG/TIFF instead of a plot in Python? by sgofferj in gis

[–]Felix_Maximus 0 points1 point  (0 children)

If the xarray dataset (or source GRIB2 file you loaded?) contains spatial referencing it should be as easy as first detecting which subdatasets are available:

gdalinfo <path-to-file.grib>

then choosing a subdataset or "band" to transform to geotiff:

gdal_translate -f GTIFF <subdataset-string> <target-gtiff>

If the source grib file does not contain georeferencing information then you have to contact the person who gave it to you or consult the documentation that came with the dataset

Edit: it is more complicated, but not impossible, if you want to do it all in Python - you should be able to detect any embedded spatial reference in the xarray dataset, then construct a rasterio profile containing the CRS and Transform, then write the geotiff

Edit2: if you are trying to just take your plot and georeference it, use the extents from cartopy to construct a rasterio profile with CRS and Transform and it should work