Skip to content

Instantly share code, notes, and snippets.

View agiudiceandrea's full-sized avatar

Andrea Giudiceandrea agiudiceandrea

View GitHub Profile
from qgis.core import *
from qgis.gui import *
import math
@qgsfunction(args='auto', group='Custom', referenced_columns=[])
def bearing(point1, point2, feature, parent):
"""
Returns the bearing, on the EPSG:7030 (WGS 84) ellipsoid, in degrees,
clock-wise from North, between two points with coordinates
expressed in the EPSG:4326 (WGS 84) CRS.
"""
***************************************************************************
punti_lungo_linea.py
---------------------
Version : 1.0
Date : 28/10/2022
Copyright : (C) 2022 by Andrea Giudiceandrea
Email : andreaerdna at libero dot it
***************************************************************************
* *
@agiudiceandrea
agiudiceandrea / bearing
Last active October 10, 2021 18:24
Expression to calculate bearing true-north based (loxodromic) between first and second point from current layer with UTM coordinates
-- by Andrea Giudiceandrea licensed under CC-BY-SA 4.0 license
degrees(
azimuth(geometry(get_feature_by_id(@layer, 1)), geometry(get_feature_by_id(@layer, 2))) -
-- the grid convergence from https://gis.stackexchange.com/a/394982/107272 by Houska
with_variable('LL', transform( geometry(get_feature_by_id(@layer, 1)),layer_property(@layer,'crs'),'EPSG:4326'),
with_variable('displacedLL',translate(@LL,0,0.001),
azimuth(geometry(get_feature_by_id(@layer, 1)),transform(@displacedLL,'EPSG:4326',layer_property(@layer,'crs')))
))
)
"""
***************************************************************************
createGeoTIFF.py
---------------------
Date : September 2021
Copyright : (C) 2021 by Andrea Giudiceandrea
Email : andreaerdna at libero dot it
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
"""
***************************************************************************
convertToGeoTIFFs.py
---------------------
Date : 29/09/2021
Copyright : (C) 2021 by Andrea Giudiceandrea
Email : andreaerdna at libero dot it
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
# -*- coding: utf-8 -*-
"""
***************************************************************************
* *
* This code is licensed by Andrea Giudiceandrea under CC-BY-SA license *
* https://creativecommons.org/licenses/by-sa/3.0/ as a derivative work *
* of the code originally published by Jochen Schwarze, under the same *
* license, at https://gis.stackexchange.com/a/198329/107272 *
* *
from qgis.core import *
from qgis.gui import *
@qgsfunction(args='auto', group='Custom')
def raggio_cerchio(qPt1, qPt2, qPt3, feature, parent):
"""
Calcola il raggio del cerchio passante per tre punti.
"""
pt1 = QgsPoint(qPt1.asPoint())
pt2 = QgsPoint(qPt2.asPoint())
Could not execute: INSERT INTO tbl_srs(srs_id, description,projection_acronym,ellipsoid_acronym,parameters,srid,auth_name,auth_id,is_geo,deprecated) VALUES (63321, 'Timbalai 1948 / RSO Sarawak LSD (m)','omerc',NULL,'+proj=omerc +no_uoff +lat_0=4 +lonc=115 +alpha=53.3158204722222 +gamma=53.1301023611111 +k=0.99984 +x_0=2000000 +y_0=5000000 +ellps=evrstSS +towgs84=-679,669,-48,0,0,0,0 +units=m +no_defs',520003321,'EPSG','29874',0,0) [NOT NULL constraint failed: tbl_srs.ellipsoid_acronym/NOT NULL constraint failed: tbl_srs.ellipsoid_acronym]
Could not execute: INSERT INTO tbl_srs(srs_id, description,projection_acronym,ellipsoid_acronym,parameters,srid,auth_name,auth_id,is_geo,deprecated) VALUES (63322, 'ETRS89','longlat',NULL,'+proj=longlat +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +no_defs',520003322,'EPSG','9286',1,0) [NOT NULL constraint failed: tbl_srs.ellipsoid_acronym/NOT NULL constraint failed: tbl_srs.ellipsoid_acronym]
Could not execute: INSERT INTO tbl_srs(srs_id, description,projection_acronym,ellipsoid_acr
@agiudiceandrea
agiudiceandrea / qgis-grass.bat
Created April 20, 2021 18:57
qgis-grass.bat per MSI installer
@ECHO OFF
SET DRV_LTR=%cd%
SET OSGEO4W_ROOT=%DRV_LTR%\qgis
PATH %PATH%;%OSGEO4W_ROOT%\apps\qgis\bin;%OSGEO4W_ROOT%\apps;%OSGEO4W_ROOT%\bin;%OSGEO4W_ROOT%\apps\grass
IF "%1" == "" (start "QGIS" /B %OSGEO4W_ROOT%\bin\qgis.bat --profiles-path %DRV_LTR%\qgisconfig) ELSE (start "QGIS" /B %OSGEO4W_ROOT%\bin\qgis.bat --profiles-path %DRV_LTR%\qgisconfig --project %1)
@agiudiceandrea
agiudiceandrea / qgis.bat
Created April 20, 2021 18:54
qgis.bat modificato per MSI installer
@echo off
call "%~dp0\o4w_env.bat"
if not exist "%OSGEO4W_ROOT%\apps\qgis\bin\qgisgrass7.dll" goto nograss
set savedpath=%PATH%
call "%OSGEO4W_ROOT%\apps\grass\grass78\etc\env.bat"
path %OSGEO4W_ROOT%\apps\grass\grass78\lib;%OSGEO4W_ROOT%\apps\grass\grass78\bin;%savedpath%
:nograss
SET PYTHONHOME=%OSGEO4W_ROOT%\apps\Python39
SET PYTHONPATH=%PYTHONHOME%;%PYTHONHOME%\Scripts