project = QgsProject().instance()
root = project.layerTreeRoot()
legendLayers = root.findLayerIds()
projectLayers = project.mapLayers().keys()
layersToRemove = set(projectLayers) - set(legendLayers)
project.removeMapLayers(list(layersToRemove))
Put this code in jour plugin:
try:
pydev_path = 'PYDEV_PATH_HERE'
import sys;sys.path.append(pydev_path)
import pydevd;pydevd.settrace()
except:
print("Error activando debugger")
from osgeo import gdal, ogr, osr
url = 'http://ovc.catastro.meh.es/INSPIRE/wfsCP.aspx?service=wfs&version=2&request=getfeature&STOREDQUERIE_ID=GetParcel&srsname=EPSG:4326&REFCAT=%s'
wfs_drv = ogr.GetDriverByName('WFS')
wfs_ds = wfs_drv.Open('WFS:' + url % refcat)
layer = wfs_ds.GetLayerByName('cp:CadastralParcel')
feat = layer.GetFeature(0)
Consulta para obtener una nueva geometría de igual dirección pero de un tamaño fijo, y partiendo del punto central:
SELECT
ST_Rotate(
ST_MakeLine(
ST_Translate(center, 0, -len / 2),
ST_Translate(center, 0, len / 2)
),
-azm,
layer = iface.mapCanvas().currentLayer()
expr1 = """count("refcat", "refcat") > 1"""
exp = QgsExpression(expr1)
exp_context = QgsExpressionContext()
exp_context.appendScope(QgsExpressionContextUtils.globalScope())
exp_context.appendScope(QgsExpressionContextUtils.projectScope())
Referencia: http://timmyreilly.azurewebsites.net/setup-a-virtualenv-for-python-3-on-windows/
mkvirtualenv --python=C:\Python36-32\python.exe python3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
SET OSGEO4W_ROOT=C:\OSGeo4W64 | |
CALL %OSGEO4W_ROOT%\bin\o4w_env.bat | |
@echo off | |
path %PATH%;%OSGEO4W_ROOT%\apps\qgis\bin | |
set PYTHONPATH=%PYTHONPATH%;%OSGEO4W_ROOT%\apps\qgis\python | |
set PYTHONPATH=%PYTHONPATH%;%OSGEO4W_ROOT%\apps\qgis\python\plugins | |
set PYTHONPATH=%PYTHONPATH%;%OSGEO4W_ROOT%\apps\Python27\Lib\site-packages | |
set QGIS_PREFIX_PATH=%OSGEO4W_ROOT%\apps\qgis |
- Instalar docker según https://docs.docker.com/engine/installation/linux/
- Instalar docker-compose por pip: '''sudo pip install docker-compose'''
NewerOlder