New answers tagged

0

Not sure how to access it directly but you can read the .qgs project as a text file, search for <extent> and print the next 4 lines: myfile = open('path/to/project_file', "r") for line in myfile: if '<extent>' in line: for index in range(4): extent = myfile.next() print (extent).replace('\n', ' ')


1

Try this for current extent: bBox = qgis.utils.iface.mapCanvas().extent()


5

In the Processing Toolbox, you can use the Clip vectors by extent tool from GDAL/OGR: Processing Toolbox > GDAL/OGR > [OGR] Geoprocessing > Clip vectors by extent


1

Esri now has a tool for this in 10.4 (hooray): Recalculate Feature Class Extent. I was running into this issue when I was creating a feature class and writing geometry into it with arcpy. Apparently those tools do not update the extent (probably a good idea for performance reasons). I have been successful resetting the extent in 10.2.2 with @Lou 's ...


2

You'll want to look inside the definition of ST_Contains, which is this: CREATE OR REPLACE FUNCTION ST_Contains(geom1 geometry, geom2 geometry) RETURNS boolean AS 'SELECT $1 ~ $2 AND _ST_Contains($1,$2)' LANGUAGE 'sql' IMMUTABLE; See what's going on? The function wraps a call to the box containment operator, ~, and the explicit polygon ...



Top 50 recent answers are included