Saturday, 29 August 2020

[QGIS] Batch reprojecting

If you need to put together data from different sources, chances are high that they are not using the same coordinate system, the same projection. Thus, you need to reproject affected layers. For a multitude of layers done one by one this is tedious and error prone work. QGIS, however, provides batch functionality to do so:

 

I believe, that the layer id is the name concatenated with a hex form of a UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format). Therefore, I just cut the last 37 characters from the layer id to obtain the pure layer name. In some QGIS documentation there is stated a layer_name variable, but I could not find that in my version, thus the substring hassle: '/home/thiemo/Downloads/auswandern/sverige/SCID_v4.0_EPSG4326/' || substr(@INPUT, 1, length(@INPUT) - 37) || '.shp'

 

 

 

Tuesday, 28 July 2020

[modelio] corrupted diagrammes

Sympom

I experienced several times now that diagrammes got currupted. Some components missing others renamed. Very annoying and tedious to fix.

Cause

I did not actually test this, but I suspect that the cause is copying a diagramme to take advantage of already defined objects. But then
  • one renames some objects
  • one deletes some objects
  • one adds objects
Latter is no problem at all but as the objects of the copy diagramme are not copies but sort of links to the original
  • renaming will rename the orignal
  • deleting will delete the original
thus rendering the original diagramme in a dire state. I have not found means neither to just remove objects from a Diagramme instead of deleting them nor to cut the link to the original.

Solution

Create an all new Diagramme.

Wednesday, 1 July 2020

[git] rename a remote branch

Apparently, it is not possible to rename a remote branch directly. You need to rename the local branch push it to a new remote branch and delete the remote branch then:
#bash
# If you are not on the branch to rename, do
git branch -m <old_name> <new_name>
# or check it out
git checkout <old_name>
git branch -m <new_name>

# Push it to the remote repo and make it track at the same time
git push origin -u <new_name>

# Delete the old branch in the remote repo
git push origin --delete <old_name>
You  might run into problems, e.g. when you already created the new remote branch, maybe using the branch functionality in JIRA to have a link between branch and issue. The symptom is when running the push to the new remote:
#bash
To ssh://git@stash-prod.pnet.ch/adw/adw1.git
 ! [rejected]        bugfix/kellnerth/SGA-1872-abhangigkeiten-in-arbitrary--monthly--outbound -> bugfix/kellnerth/SGA-1872-abhangigkeiten-in-arbitrary--monthly--outbound (non-fast-forward)
error: failed to push some refs to 'ssh://git@stash-prod.pnet.ch/adw/adw1.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
This behaviour is independent of pulling from the repository. You can push the new branch to remote by forcing it, e.g.
#bash
git push -f origin <new_name>
Apparently it is not a good solution. I ended up with two local branches apart from the "prefix" origin/ identically named. The local "origin" branch was not tracking any

[git] Create a local branch from another branch

From the active branch git checkout -b <LOCAL_BRANCH> From a donator branch git checkout -b <LOCAL_BRANCH> <DONATING_BRANCH...