Skip to main content
5 votes

Reasons of slow intersection of two GeoDataFrames using Python

1. Why is it so much slower The spatial index works as follows: it ~stores the bboxes of the geometries of a layer in an efficient tree structure so it can be very quickly determined if a given bbox ...
Pieter's user avatar
  • 2,749
4 votes
Accepted

Install GDAL into conda environment

When using conda it is in general a good idea to avoid mixing packages from different channels. Anaconda and miniconda use defaults as default channel, so when you use conda install -c conda-forge ...
Pieter's user avatar
  • 2,749
4 votes

Converting image data type from uint16 to uint8 using Python

Your data corruption is caused by integer overflow. Once a numpy integer goes outside the range of a datatype (0-255 for uint8), the value overflows and wraps around to 0 again. For example: np....
user2856's user avatar
  • 66.5k
3 votes
Accepted

Converting GeoPandas points to polygons and retaining column information

You need to turn your res GeoSeries object into a GeoDataFrame and convert the series index back to a column. In one line res = gpd.GeoDataFrame(gdf.dissolve("GroupName").convex_hull)....
user2856's user avatar
  • 66.5k
3 votes

Integrating an External Python Script into a QGIS Project Macro

You can run external .py script with a command like this: exec(open('filename.py').read()) But I'm not sure if this is a good practice, since the location of the file may change. In addition, it ...
Comrade Che's user avatar
  • 7,191
2 votes
Accepted

How could I set 8CONNECTED into gdal.Polygonize()

That function is not well documented. But looking at the C docs and the tests, I can see that it's a list of options and values as strings, i.e. ["option_name=value", "another_option=...
user2856's user avatar
  • 66.5k
1 vote

Export Feature as GPX from Virtual Layer Using Right-Click in QGIS

This turned out to be much more than a barebones answer. It includes a few things that aren't strictly necessary, but make the tool much easier to use. Such as, highlighting the clicked feature, a ...
Matt's user avatar
  • 17.3k
1 vote

gdal.Translate producing error

Following directions from user2856 and Michael Stimson, I found out that the data directory in use had no write permission for the running user, thus producing the error. Calling gdal.UseExceptions() ...
Ubron Cinzento's user avatar
1 vote

Pixel-based regression using xarray has incorrect P-value, but everything else is correct

There is a more recent implementation of the lag_linregress_3D function in this Stack Overflow answer here - it has recently been updated to include calculating p-values for different alternative ...
Robbi Bishop-Taylor's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible