New answers tagged


Based on this answer, you can define a schema: import geopandas as gpd df = gpd.read_file('test.shp') # Add a couple of fields that don't exist already df['shortint'] = 1 df['longint'] = 2 # Get geopandas to populate a schema dict so we don't have to build it from scratch schema = schema['properties']['shortint'] = 'int32:4' #...


OK, I figured out the error. I had to add a common field to both field lists (RecyAuditFieldList and SpatialJoinFields) which are OBJECTID and TARGET_FID. The edited list looks like this: RecyAuditFieldList = ["OID@","Week","RecycleRt","RecyCollDay"] SpatialJoinFields = ["TARGET_FID","Week", "...


Here's how to use import subprocess import numpy as np import pathlib ## example dummy ids id1 = np.linspace(start=1, stop=1, num=1, endpoint=True, dtype=int) id2 = np.linspace(start=1, stop=1, num=1, endpoint=True, dtype=int) infile = '/tmp/points.shp' inlayer = pathlib.Path(infile).stem outpath = pathlib.Path("/tmp").resolve() ...


There may be an easier solution. As an example below, the Python module would be 'mypackage'. Open QGIS Open the Python Console by clicking on the icon or from the main menu/Plugins. In the console type import pip In the console type pip.main(['install','mypackage']) It worked for me in Windows/QGIS 3.16

Top 50 recent answers are included