<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:media="http://search.yahoo.com/mrss/"><channel><title><![CDATA[null]]></title><description><![CDATA[null]]></description><link>https://qtibia.com/</link><image><url>https://qtibia.com/favicon.png</url><title>null</title><link>https://qtibia.com/</link></image><generator>Ghost 4.5</generator><lastBuildDate>Fri, 10 Apr 2026 23:59:23 GMT</lastBuildDate><atom:link href="https://qtibia.com/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[How to debug a QGIS plug-in from Pycharm]]></title><description><![CDATA[If you want to debug your new QGIS plug-in by using Pycharm then you are on the right page. ]]></description><link>https://qtibia.com/how-to-debug-a-qgis-plug-in-from-pycharm/</link><guid isPermaLink="false">60f960af2dea5b0001db3009</guid><category><![CDATA[debug]]></category><category><![CDATA[2021]]></category><category><![CDATA[QGIS]]></category><category><![CDATA[how to install]]></category><category><![CDATA[PyCharm]]></category><dc:creator><![CDATA[Nicolae Marinica]]></dc:creator><pubDate>Wed, 18 Aug 2021 09:40:00 GMT</pubDate><media:content url="https://qtibia.com/content/images/2021/07/debug-plugin-qgis-1.png" medium="image"/><content:encoded><![CDATA[<!--kg-card-begin: markdown--><img src="https://qtibia.com/content/images/2021/07/debug-plugin-qgis-1.png" alt="How to debug a QGIS plug-in from Pycharm"><p>I will consider as a prerequisite having the QGIS and Pycharm installed and knowing how to use them. Since we want to use Pycharm&apos;s remote debugging function we need to install the Professional version of Pycharm (as described by <a href="https://www.jetbrains.com/help/pycharm/remote-debugging-with-product.html">https://www.jetbrains.com/help/pycharm/remote-debugging-with-product.html</a>).</p>
<p>We install the pydevd-pycharm library by opening the Pycharm QGIS plug-in project. Select Edit Configurations... from Run/Debug Configurations to open the edit page as shown below:</p>
<p><img src="https://qtibia.com/content/images/2021/07/Screenshot-from-2021-07-15-10-57-06.png" alt="How to debug a QGIS plug-in from Pycharm" loading="lazy"></p>
<p>Use the + sign to add a new configuration (or Alt + Insert) and select Python Debug Server. In our case, we created a new Python Debug Server configuration called qgisDebugger in our case.</p>
<p><img src="https://qtibia.com/content/images/2021/07/Screenshot-from-2021-07-15-10-59-31.png" alt="How to debug a QGIS plug-in from Pycharm" loading="lazy"></p>
<p>In order to have the debugger running, we need to install the pydevd-pycharm library as described by the message displayed on the right side of the window. For doing this you either use directly execute while in Python:<br>
<code>pip install pydevd-pycharm~=211.7628.24</code></p>
<p>Or directly in Pycharm by using the interpreter settings as shown in the following picture:</p>
<p><img src="https://qtibia.com/content/images/2021/07/Screenshot-from-2021-07-15-12-31-12.png" alt="How to debug a QGIS plug-in from Pycharm" loading="lazy"></p>
<p>After the pydevd-pycharm library was installed, we need to set-up:</p>
<ul>
<li>IDE host name as 127.0.0.1,</li>
<li>Port as 53100,</li>
<li>and have &#x201C;Redirect output to console&#x201D; and &#x201C;Suspend after connect&#x201D; selected.</li>
</ul>
<p>Once we have the new Python Debug Server configuration saved, we need to perform one more action before being able to work with the debugger. Import the pydevd-pycharm package in the python module that needs to be debugged and copy the following statement:<br>
<code>pydevd_pycharm.settrace(&apos;127.0.0.1&apos;, port=53100, stdoutToServer=True, stderrToServer=True)</code></p>
<p>In the place where you want to stop first. The statement is equivalent to a breakpoint thus when the debugger is executed it will first stop at its position. Save the modifications and click on the debug button after yous elected the new configuration as shown in the below figure:</p>
<p><img src="https://qtibia.com/content/images/2021/07/Screenshot-from-2021-07-15-12-47-13.png" alt="How to debug a QGIS plug-in from Pycharm" loading="lazy"></p>
<p>Once you click on the debug button in Pycharm, the server will wait for a connection (also shown in the terminal). Open the QGIS and (re)load the plug-in. First the operation will stop where we introduced the <em>pydevdpycharm.settrace()</em> command and after we continut at any breakpoint introduced by use in Pycharm.</p>
<p>If you want to run the plug-in code without the debugger, you need to comment out the <em>pydevdpycharm.settrace()</em>. Otherwise, QGIS will crash loading the plug-in without having the Debug Server started.</p>
<!--kg-card-end: markdown--><p></p><p></p>]]></content:encoded></item><item><title><![CDATA[How to install the PL/PGSQL debugger and use it in PgAdmin]]></title><description><![CDATA[An easier and useful way for how to debug PL/pgSQL functions in PostgreSQL.]]></description><link>https://qtibia.com/how-to-install-the-pl-pgsql-debugger-and-use-it-in-pgadmin/</link><guid isPermaLink="false">60f95ddb2dea5b0001db2fdd</guid><category><![CDATA[debug]]></category><category><![CDATA[QGIS]]></category><category><![CDATA[pgsql]]></category><category><![CDATA[psql]]></category><category><![CDATA[pgadmin]]></category><category><![CDATA[2021]]></category><category><![CDATA[how to install]]></category><category><![CDATA[tutorial]]></category><dc:creator><![CDATA[Nicolae Marinica]]></dc:creator><pubDate>Fri, 23 Jul 2021 13:17:25 GMT</pubDate><media:content url="https://qtibia.com/content/images/2021/07/tutorial-instalare-pl-pgsql-pg-admin4.png" medium="image"/><content:encoded><![CDATA[<!--kg-card-begin: markdown--><img src="https://qtibia.com/content/images/2021/07/tutorial-instalare-pl-pgsql-pg-admin4.png" alt="How to install the PL/PGSQL debugger and use it in PgAdmin"><p>The debugger is an extension of PostgreSQL installation and it needs to be installed and configured in order to be able to use it.</p>
<p>Once installed, it can be very useful to debug PL/pgSQL functions in PostgreSQL, EDB-SPL functions, or stored procedures.</p>
<p>I thereby explain the necessary steps to install and enable the debugger. In my case I have already installed PostgreSQL version 13.3 and pgAdmin version 5.4 so I will not cover how to install these two.</p>
<p>First install the PostgreSql pldebugger:<br>
<code>sudo apt-get install postgresql-13-pldebugger</code></p>
<p>In case that the package is not available it can be also compiled:<br>
<code>sudo apt-get install build-essential</code><br>
<code>sudo apt-get install postgresql-server-dev-13</code><br>
<code>cd /usr/local/src</code><br>
<code>git clone git://git.postgresql.org/git/pldebugger.git</code><br>
<code>cd pldebugger</code><br>
<code>export USE_PGXS=1</code><br>
<code>make</code><br>
<code>make install</code></p>
<p>Once installed, you need to edit the postgresql.conf by:<br>
<code>sudo nano /etc/postgresql/13/main/postgresql.conf</code></p>
<p>Use Ctrl+W to search for shared_preload_libraries, replace it with:<br>
<code>shared_preload_libraries = &apos;plugin_debugger&apos;</code></p>
<p>Save the changes (Ctrl+X and press Y followed by Enter). Once this part is done you need to restart PostgreSQL service by:<br>
<code>sudo service postgresql stop</code><br>
<code>sudo service postgresql start</code></p>
<p>In order to check if everything is up and running, you need to check the PostgreSQL log:<br>
<code>sudo tail -f /var/log/postgresql/postgresql-13-main.log</code></p>
<p>The last step is to enable the debugger in a PostgreSQL database that you want to debug by installing the extension with:<br>
<code>CREATE EXTENSION pldbgapi;</code></p>
<p>You can do this either from the PostgreSQLcommand line or from pgAdmin directly.</p>
<p>Now let us assume that we want to debug the get_film_count (len_from integer, len_to integer) function that returns the number of films that have the length between len_from and len_to.</p>
<p>In pgAdmin navigate to the same database and right click the PL/pgSQL function get_film_count(integer,integer). We have now two new tools, Debug and Set BreakPont, as shown in the following figure:</p>
<p><img src="https://qtibia.com/content/images/2021/07/pgAdmin_debugger_menu.jpg" alt="How to install the PL/PGSQL debugger and use it in PgAdmin" loading="lazy"></p>
<p>In the context menu choose Debugging &gt; Debug and a Debugger window will open to  prompt for any parameters (as seen in the below figure).</p>
<p><img src="https://qtibia.com/content/images/2021/07/pgAdmin_debug.jpg" alt="How to install the PL/PGSQL debugger and use it in PgAdmin" loading="lazy"></p>
<p>Once some values are given (len_from and len_to in our case), it will then break on the first line of the function after the Debug button is clicked.</p>
<p>In the other context menu, if you choose Debugging -&gt; Set breakpoint the following window opens:</p>
<p><img src="https://qtibia.com/content/images/2021/07/pgAdmin_set_breakpoint.jpg" alt="How to install the PL/PGSQL debugger and use it in PgAdmin" loading="lazy"></p>
<p>Waiting for the next function call. When a function call happens, the debugger waits for you to add breakpoints, or step through it line-by-line.</p>
<p>I found the debugger &#x201C;a must have&#x201D; for developing and debugging PL/pgSQL functions in PostgreSQL. More information about how to use the pgAdmin debugger can be found in <a href="https://www.pgadmin.org/docs/pgadmin4/latest/debugger.html">the official documentation</a></p>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[Speed up your QGIS build times]]></title><description><![CDATA[Everyone wants more speed, right? So, I'm going to present one solution that I haven't encountered until two days ago!]]></description><link>https://qtibia.com/speed-up-your-qgis-build-times/</link><guid isPermaLink="false">5df4c06e220a78000194c389</guid><category><![CDATA[QGIS]]></category><category><![CDATA[speed]]></category><category><![CDATA[build time]]></category><category><![CDATA[tutorial]]></category><dc:creator><![CDATA[Tudor Barascu]]></dc:creator><pubDate>Fri, 25 May 2018 09:48:48 GMT</pubDate><media:content url="https://qtibia.com/content/images/2021/06/speed-up-you-qgis-build-times.png" medium="image"/><content:encoded><![CDATA[<!--kg-card-begin: markdown--><img src="https://qtibia.com/content/images/2021/06/speed-up-you-qgis-build-times.png" alt="Speed up your QGIS build times"><p>There are lots of ways of speeding your QGIS build times, some of them described in the <a href="https://github.com/qgis/QGIS/blob/master/INSTALL">INSTALL</a> file, other on blog posts like <a href="https://nathanw.net/2016/05/26/speeding-up-qgis-build-times-with-ninja/">Nathan&apos;s</a> or on the QGIS Developers Mailing list.</p>
<p>But everyone wants more speed, right? So, I&apos;m going to present one solution that I haven&apos;t encountered until two days ago so I thought of letting everybody know. Maybe all of you do it and I&apos;m the last one to the party :).</p>
<p>I was planning to switch to the new quad core mobile processors (either Intel or AMD) and digging around I settled on a Thinkpad T480s. As I like to do my homework, the finest article I could find is from a laptop review site that I can wholeheartedly recommend: <a href="https://www.notebookcheck.net/Lenovo-ThinkPad-T480s-i5-WQHD-Laptop-Review.284832.0.html">notebookcheck.net</a></p>
<p>From the article in the link above, I found out that I can do some fine tuning and utilize the full performance potential of my CPU by keeping the core at much higher frequencies for prolongued periods of time. You never get this out of the box because all the chips are shipped from the factory with a safety margin in their default operating voltage. This is all because there is a level of variation in every chip although their naming is the same (your i5-8250U is different then mine).</p>
<p>Knowing this, you can fine tune your chip and do <strong>undervolting</strong> with some specific tools. As a result, you can either:</p>
<ul>
<li>get some performance benefits without sacrificing temperature or power consumption</li>
<li>get even more performance at the expense of some increase in temperature and in power consumption</li>
<li>decrease your battery consumption and the chip temperature.</li>
</ul>
<p>Your choice!</p>
<p>If your laptop cooling solution is good (the T480s has a nifty cooling system, as it was setup to support also a dedicated NVIDIA card) you can go with the &quot;far more performance&quot; mode as the increase in temperature is noticeable only when you look at the temperature metrics.<br>
Does it bother you if you consume 10 W more while you laptop is plugged in? I am surely not bothered!</p>
<p>Out of the box, my QGIS building time under Linux was 39 minutes 12 s, with each core running stable at 2400MHz after few minutes.</p>
<p>Now I get 29 minutes 15 seconds, each core stabilizing at around 3200MHz, so I shaved around 10 minutes of my building time, which is quite a lot!</p>
<table border="1">
<caption>QGIS Build from source - statistics</caption>
<tr><th>Notebook</th><th>Time</th><th>CPU Speed</th><th>CPU temp
    </th></tr><tr><td>Macbook Pro 13,1 <p></p>i5-6360u double core</td><td>83m25s</td><td>2900 MHz</td><td>77 C
</td></tr><tr><td>Thinkpad T480s <p></p>i5-8250U quad core</td><td>39m12s</td><td>2400 MHz</td><td>65 C
</td></tr><tr><td>same T480s undervolted</td><td>29m15s</td><td>3200 MHz</td><td>85 C
</td></tr></table>
<p>Look at my poor MacBook Pro from 2016.. running Linux of course.<br>
Now I&apos;m more than 50 Minutes faster. Can&apos;t believe it!</p>
<p>If you want to compare your build time, I used the following parameters under Debian Buster:</p>
<pre><code>cmake -G Ninja -D CMAKE_BUILD_TYPE=Debug -D CMAKE_INSTALL_PREFIX=/home/web/qgis-master -D WITH_ASTYLE=ON -D WITH_APIDOC=ON -D WITH_CUSTOM_WIDGETS=ON -D WITH_QWTPOLAR=ON -D WITH_INTERNAL_QWTPOLAR=ON -D WITH_SERVER=ON -D SERVER_SKIP_ECW=ON -D ENABLE_TESTS=ON -D ENABLE_PGTEST=ON -D WITH_3D=False ..
</code></pre>
<p>My ThinkPad T480s with its 15W TDP <a href="https://www.notebookcheck.net/Intel-Core-i5-8250U-SoC-Benchmarks-and-Specs.242172.0.html">i5-8250U</a> even surpasses some units with the 45 W chip Core i7-7700HQ. Now that&apos;s really cool, ain&apos;t it?</p>
<p>To quote from the article above:</p>
<pre><code>Undervolting: We managed to reduce the core voltage of our processor by 125 mV, which stabilizes the performance and reduce both the temperature as well as the consumption at the same time.
</code></pre>
<p>If you want another nice article of undervolting the T480s and the X1 Carbon 6th generation you can check <a href="https://www.notebookcheck.net/More-performance-and-quieter-fans-with-Intel-XTU-Undervolting-the-ThinkPad-X1-Carbon-2018-ThinkPad-T480s.296752.0.html">this one</a>.</p>
<p>How did I specifically did it?</p>
<p>I installed Windows on a stick, and with XTU I determined the stable undervolting parameters for my CPU:</p>
<ul>
<li>&apos;CPU&apos; -90 mV (fate has it that my CPU was not as good as the one the guys from notebookcheck got as I didn&apos;t manage to go to 125mV like they did)</li>
<li>&apos;CPU Cache&apos; -90 mV</li>
<li>&apos;GPU&apos; -90 mV</li>
</ul>
<p>I immediately noticed benchmark improvements under Windows which I won&apos;t post here as my target was and is to have the improvements under Linux.</p>
<p>For my Linux machine (Debian) things are not as easy to do as on Windows. Those bad boys from Intel didn&apos;t do a XTU for Linux.</p>
<p>I found out of <a href="https://github.com/kitsunyan/intel-undervolt">this</a> reverse engineered project  and I&apos;m using it despite the Disclaimer:</p>
<pre><code>This tool may damage your hardware since it uses reverse engineered methods of MSR usage. Use it on your own risk.
</code></pre>
<p>My <code>/etc/intel-undervolt.conf</code> config looks like this:</p>
<pre><code># CPU Undervolting
# Usage: apply ${index} ${display_name} ${undervolt_value}
# Example: apply 2 &apos;CPU Cache&apos; -25.84

apply 0 &apos;CPU&apos; -90
apply 1 &apos;GPU&apos; -90
apply 2 &apos;CPU Cache&apos; -90
apply 3 &apos;System Agent&apos; 0
apply 4 &apos;Analog I/O&apos; 0

# TDP Alteration
# Usage: tdp ${short_term} ${long_term}
# Example: tdp 45 35
tdp 45 45
# Critical Temperature Offset Alteration
# Usage: tjoffset ${temperature_offset}
# Example: tjoffset -20
tjoffset -15
</code></pre>
<p>Notice that I made the temperature offset to -15. This means that on my specific chip with 100 degrees C limit I enforced the upper temperature limit at 85 degrees as I like to keep my notebook surface cool enough so it doesn&apos;t bother me.</p>
<p>There is a trick (learned after quite some time of trial and error) in that it won&apos;t work until you set your CPU scaling Governor in <code>performance mode</code>.</p>
<p>You can use <code>cpupower</code> to do it after installing it with <code>apt-get install linux-cpupower</code>.</p>
<p>Check first what&apos;s your current situation with <code>cpupower frequency-info</code> which should output something like:</p>
<pre><code>analyzing CPU 0:
  driver: intel_pstate
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency:  Cannot determine or is not supported.
  hardware limits: 400 MHz - 3.40 GHz
  available cpufreq governors: performance powersave
  current policy: frequency should be within 400 MHz and 3.40 GHz.
          The governor &quot;powersave&quot; may decide which speed to use within this range.
  current CPU frequency: Unable to call hardware
  current CPU frequency: 1.52 GHz (asserted by call to kernel)
  boost state support:
    Supported: yes
    Active: yes
</code></pre>
<p>Notice the <code>The governor &quot;powersave&quot; may decide which speed to use within this range.</code> part which tells you that you&apos;re in <code>powersave</code> mode.</p>
<p>By doing <code>cpupower frequency-set -g performance</code> you can put it in performace mode and your CPU will fly over the performance realms.</p>
<p>I&apos;ve used the <code>sensors</code> utility by doing <code>watch -n 1 sensors</code> plus the <code>watch -n 1 grep \&quot;cpu MHz\&quot; /proc/cpuinfo</code> command to check the improvements and to see the CPU temperature.</p>
<p>The commands output:</p>
<pre><code>Every 1.0s: sensors          thinkpad: Fri May 25 12:23:18 2018

iwlwifi-virtual-0
Adapter: Virtual device
temp1:            N/A  

pch_skylake-virtual-0
Adapter: Virtual device
temp1:        +66.0&#xB0;C  

acpitz-virtual-0
Adapter: Virtual device
temp1:        +84.0&#xB0;C  (crit = +128.0&#xB0;C)

thinkpad-isa-0000
Adapter: ISA adapter
fan1:        4291 RPM

coretemp-isa-0000
Adapter: ISA adapter
Package id 0:  +85.0&#xB0;C  (high = +100.0&#xB0;C, crit = +100.0&#xB0;C)
Core 0:        +85.0&#xB0;C  (high = +100.0&#xB0;C, crit = +100.0&#xB0;C)
Core 1:        +84.0&#xB0;C  (high = +100.0&#xB0;C, crit = +100.0&#xB0;C)
Core 2:        +81.0&#xB0;C  (high = +100.0&#xB0;C, crit = +100.0&#xB0;C)
Core 3:        +83.0&#xB0;C  (high = +100.0&#xB0;C, crit = +100.0&#xB0;C)
</code></pre>
<pre><code>Every 1.0s: grep &quot;cpu ...  thinkpad: Fri May 25 12:22:57 2018

cpu MHz         : 3217.363
cpu MHz         : 3217.202
cpu MHz         : 3217.075
cpu MHz         : 3216.951
cpu MHz         : 3216.628
cpu MHz         : 3216.522
cpu MHz         : 3216.501
cpu MHz         : 3216.220
</code></pre>
<p>As I usually keep my notebook plugged in I created a systemd service to set it in performance mode when it boots with:</p>
<pre><code>cat &lt;&lt; EOF | tee /etc/systemd/system/cpupower.service
[Unit]
Description=CPU powersave

[Service]
Type=oneshot
ExecStart=/usr/bin/cpupower -c all frequency-set -g performance

[Install]
WantedBy=multi-user.target
EOF

systemctl enable cpupower.service
</code></pre>
<p>When I&apos;m not plugged in, I simply do a <code>cpupower frequency-set -g powersave</code> to prolong the battery life.</p>
<p>Or.. better yet, you could install <code>acpi</code> with <code>apt-get install acpi -y</code>, add this to a bash script <code>/root/switch_governor.sh</code> with the following content:</p>
<pre><code>plugged_in=$(acpi -a | cut -d&apos; &apos; -f3 | cut -d- -f1)

if [ &quot;$plugged_in&quot; = &quot;on&quot; ]; then
    cpupower frequency-set -g performance
else
    cpupower frequency-set -g powersave
fi
</code></pre>
<p>Make it executable with <code>chmod +x /root/switch_governor.sh</code> and add to your root crontab (<code>crontab -e -u root</code>):</p>
<pre><code>*/1 * * * * /root/switch_governor.sh
</code></pre>
<p>This checks each minute if your laptop is plugged in and sets the governor appropiately.</p>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[Build QGIS with Oracle Spatial support]]></title><description><![CDATA[Here's how to build QGIS with Oracle Spatial support.]]></description><link>https://qtibia.com/build/</link><guid isPermaLink="false">5df4c06e220a78000194c388</guid><category><![CDATA[QGIS]]></category><category><![CDATA[tutorial]]></category><category><![CDATA[qgis build]]></category><category><![CDATA[oracle spatial]]></category><dc:creator><![CDATA[Tudor Barascu]]></dc:creator><pubDate>Mon, 15 Jan 2018 09:40:39 GMT</pubDate><media:content url="https://qtibia.com/content/images/2021/06/build-qgis-with-oracle-spatial-support.png" medium="image"/><content:encoded><![CDATA[<!--kg-card-begin: markdown--><img src="https://qtibia.com/content/images/2021/06/build-qgis-with-oracle-spatial-support.png" alt="Build QGIS with Oracle Spatial support"><p>Here&apos;s how to build QGIS with Oracle support on Debian based systems (this means also Ubuntu).</p>
<p>I&apos;m using <strong>Debian Testing</strong> which at the time of writing this article has the codename <strong>Buster</strong>.</p>
<p>First, you need to install the QGIS build dependencies. One way of doing that is to get the dependencies that are written in the <a href="https://github.com/qgis/QGIS/blob/master/INSTALL">https://github.com/qgis/QGIS/blob/master/INSTALL</a>.</p>
<p>Sometimes, there&apos;s an updating lag for the dependencies written in the <strong>INSTALL</strong> document so I tend to use the <code>apt-get build-dep</code> command.</p>
<p>In order to do that, you need to configure the QGIS software repositories on your linux box if you haven&apos;t done it already. See <a href="https://qgis.org/en/site/forusers/alldownloads.html#debian-ubuntu">https://qgis.org/en/site/forusers/alldownloads.html#debian-ubuntu</a></p>
<p>Depending on what version of QGIS you want to compile, add your corresponding repositories.</p>
<p>For QGIS 3 (master) on my box (Buster is not available yet in the QGIS repos, but Stretch works).<br>
So I added to the <code>/etc/apt/sources.list</code> the following lines:</p>
<pre><code>deb http://qgis.org/debian-nightly stretch main
deb-src http://qgis.org/debian-nightly stretch main
</code></pre>
<p>Don&apos;t forget to add the qgis.org repository public key to your apt keyring as specified in the above qgis.org link.</p>
<p>After you add the repositories do an <code>sudo apt-get update</code> to get the latest lists of packages.</p>
<p>Now you can install the dependencies by doing <code>sudo apt-get build-dep qgis</code>. For the oracle build you also need to do a <code>sudo apt-get install qtbase5-private-dev qt5-default</code></p>
<p>Now let&apos;s install the Oracle dependencies:</p>
<pre><code>mkdir -p ~/dev/oracle &amp;&amp; cd ~/dev/oracle
</code></pre>
<p>In order to download the dependencies from Oracle (<a href="http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html">http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html</a>) you need to register an account.<br>
After you made your account you need to download the following files in the <code>~/dev/oracle</code> directory:</p>
<p><a href="http://download.oracle.com/otn/linux/instantclient/122010/oracle-instantclient12.2-basic-12.2.0.1.0-1.x86_64.rpm">http://download.oracle.com/otn/linux/instantclient/122010/oracle-instantclient12.2-basic-12.2.0.1.0-1.x86_64.rpm</a></p>
<p><a href="http://download.oracle.com/otn/linux/instantclient/122010/oracle-instantclient12.2-jdbc-12.2.0.1.0-1.x86_64.rpm">http://download.oracle.com/otn/linux/instantclient/122010/oracle-instantclient12.2-jdbc-12.2.0.1.0-1.x86_64.rpm</a></p>
<p><a href="http://download.oracle.com/otn/linux/instantclient/122010/oracle-instantclient12.2-sqlplus-12.2.0.1.0-1.x86_64.rpm">http://download.oracle.com/otn/linux/instantclient/122010/oracle-instantclient12.2-sqlplus-12.2.0.1.0-1.x86_64.rpm</a></p>
<p><a href="http://download.oracle.com/otn/linux/instantclient/122010/oracle-instantclient12.2-devel-12.2.0.1.0-1.x86_64.rpm">http://download.oracle.com/otn/linux/instantclient/122010/oracle-instantclient12.2-devel-12.2.0.1.0-1.x86_64.rpm</a></p>
<p><a href="http://download.oracle.com/otn/linux/instantclient/122010/oracle-instantclient12.2-odbc-12.2.0.1.0-2.x86_64.rpm">http://download.oracle.com/otn/linux/instantclient/122010/oracle-instantclient12.2-odbc-12.2.0.1.0-2.x86_64.rpm</a></p>
<p><a href="http://download.oracle.com/otn/linux/instantclient/122010/oracle-instantclient12.2-tools-12.2.0.1.0-1.x86_64.rpm">http://download.oracle.com/otn/linux/instantclient/122010/oracle-instantclient12.2-tools-12.2.0.1.0-1.x86_64.rpm</a></p>
<p>From what I can recall, not all of these are needed but at the time when I took the notes I wanted to do some extra stuff, you have it all.</p>
<p>To install the rpm files on a debian system:</p>
<pre><code>sudo apt-get install alien libaio1 -y
# Create the deb files from the rpm ones:
sudo alien oracle-instantclient12.2-*
# install the deb files
sudo dpkg -i oracle-instantclient12.2-*.deb
# setup the libraries
sudo sh -c &apos;echo &quot;/usr/lib/oracle/12.2/client64/lib&quot; &gt; /etc/ld.so.conf.d/oracle.conf&apos;
sudo ldconfig
# check that the libraries are loaded with
sudo ldconfig -p | grep oracle
</code></pre>
<p>Setup the Oracle variables that many programs lool for by adding to the <code>/etc/profile.d/oracle.sh</code> file:</p>
<pre><code>export ORACLE_HOME=/usr/lib/oracle/12.2/client64
export PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_INCLUDEDIR=${ORACLE_HOME}/include
export ORACLE_LIBDIR=${ORACLE_HOME}/lib
</code></pre>
<p>Fix SDK (<code>.h</code> files) finding if there is no <code>include</code> directory under <code>ORACLE_HOME</code>, and it is located over in <code>/usr/include/oracle/</code>, by creating a symbolic link to assist packages looking for these header files:</p>
<pre><code>sudo ln -s /usr/include/oracle/12.2/client64 /usr/lib/oracle/12.2/client64/include
sudo mount --bind /usr/include/oracle/12.2/client64 /usr/lib/oracle/12.2/client64/include
</code></pre>
<p>See also <a href="https://help.ubuntu.com/community/Oracle%20Instant%20Client">https://help.ubuntu.com/community/Oracle Instant Client</a> for more info.</p>
<pre><code>mkdir -p ~/dev/cpp &amp;&amp; cd ~/dev/cpp
git clone https://github.com/qgis/QGIS.git qgis
mkdir qgis/build-master &amp;&amp; cd qgis/build-master
</code></pre>
<p>If you want to look at the compile options graphically you should first do a <code>sudo apt-get install cmake-curses-gui</code>.<br>
Now that the <code>ccmake</code> command is installed you can play around with it by doing a <code>ccmake -G Ninja ..</code> that should first output something like this:</p>
<pre><code>EMPTY CACHE

EMPTY CACHE:
Press [enter] to edit option Press [d] to delete an entry       

CMake Version 3.9.5
Press [c] to configure
Press [h] for help           Press [q] to quit without generating
Press [t] to toggle advanced mode (Currently Off)
</code></pre>
<p>By pressing <code>c</code> at least one time you can get an automatic configuration. Most of the options are automatically configured but some need to be specified.</p>
<table border="1" ">
<caption>
    <em>Some options that are important (for me at least)</em>
</caption>
<tr>
<th>Config Option</th><th>Configured option
</th></tr><tr><th>CMAKE_BUILD_TYPE</th><td>Debug
</td></tr><tr><th>CMAKE_INSTALL_PREFIX</th><td>$HOME/qgis-master
</td></tr><tr><th>WITH_CUSTOM_WIDGETS</th><td>ON
</td></tr><tr><th>WITH_QWTPOLAR</th><td>ON
</td></tr><tr><th>WITH_INTERNAL_QWTPOLAR</th><td>ON
</td></tr><tr><th>WITH_ORACLE</th><td>ON
</td></tr><tr><th>OCI_INCLUDE_DIR</th><td>/usr/lib/oracle/12.2/client64/include
</td></tr><tr><th>OCI_LIBRARY</th><td>/usr/lib/oracle/12.2/client64/lib/libclntsh.so.12.1
</td></tr></table>
<p>Keep in mind that some of the options appear after configuring others and pressing <code>c</code> again. If it looks ok to you, and you have the press <code>g</code> option, press it and then start the build.</p>
<p>I personally don&apos;t use ccmake anymore since I&apos;m using the cmake arguments to configure my build:</p>
<pre><code>cmake \
-G Ninja \
-D CMAKE_BUILD_TYPE=Debug \
-D CMAKE_INSTALL_PREFIX=$HOME/qgis-master \
-D WITH_ASTYLE=ON \
-D WITH_APIDOC=ON \
-D WITH_CUSTOM_WIDGETS=ON \
-D WITH_QWTPOLAR=ON -D WITH_INTERNAL_QWTPOLAR=ON \
-D WITH_SERVER=ON -D SERVER_SKIP_ECW=ON \
-D WITH_ORACLE=ON \
-D OCI_INCLUDE_DIR=/usr/lib/oracle/12.2/client64/include \
-D OCI_LIBRARY=/usr/lib/oracle/12.2/client64/lib/libclntsh.so.12.1 \
..
</code></pre>
<p>If you want to install it instead of running QGIS from the <code>output</code> directory you need to do:</p>
<pre><code>sudo ninja install
sudo chown -R $USER:$USER $HOME/qgis-master
</code></pre>
<p>You need root privileges for the install if you have built <code>WITH_CUSTOM_WIDGETS</code>, otherwise, the installer won&apos;t have installing rights in the QT folders. The above command restores the rights in the <code>$HOME</code> folder to its user.</p>
<p>In order to run QGIS from the install dir, we create the <code>$HOME/qgis-master/bin/start-qgis-master.sh</code> file with the following content:</p>
<pre><code>export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${HOME}/qgis-master/lib/:${HOME}/dev/cpp/oracle-client/instantclient_12_1

${HOME}/qgis-master/bin/./qgis
</code></pre>
<p>Rnning <code>sh $HOME/qgis-master/bin/start-qgis-master.sh</code> should start QGIS with ORACLE support.W</p>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[Install pgAdmin 4 as a service under linux]]></title><description><![CDATA[Learn how to install pgAdmin 4 as a service under linux.]]></description><link>https://qtibia.com/install-pgadmin-4-as-a-service-under-linux/</link><guid isPermaLink="false">5df4c06e220a78000194c381</guid><category><![CDATA[PostgreSQL]]></category><category><![CDATA[pgadmin]]></category><category><![CDATA[pgadmin4]]></category><category><![CDATA[install]]></category><category><![CDATA[tutorial]]></category><category><![CDATA[linux]]></category><dc:creator><![CDATA[Tudor Barascu]]></dc:creator><pubDate>Tue, 01 Nov 2016 09:09:40 GMT</pubDate><media:content url="https://qtibia.com/content/images/2021/06/install-pgadmin-4-as-a-service-under-linux.png" medium="image"/><content:encoded><![CDATA[<!--kg-card-begin: markdown--><img src="https://qtibia.com/content/images/2021/06/install-pgadmin-4-as-a-service-under-linux.png" alt="Install pgAdmin 4 as a service under linux"><p>Now that <a href="https://www.pgadmin.org/docs4/dev/index.html">pgAdmin 4</a>  is out you may want to install it on your linux machine.</p>
<p>As for debian/ubuntu at least there aren&apos;t any packages build yet here&apos;s a way to do it.</p>
<p><strong>Create a Python 3 virtual environment</strong></p>
<p>You can do without a virtual environment but that&apos;s how I like to do things.</p>
<p>Install the needed packages (you can also build Python from source if you fancy another Python version that what you already have in your OS) with <code>sudo apt-get install python3-dev python3-venv wget</code></p>
<p>Create a virtual environment and activate it with:<br>
<code>python3 -m venv pgadmin4 &amp;&amp; source pgadmin4/bin/activate</code></p>
<p><strong>Download, configure and run</strong></p>
<pre><code>wget https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v6.11/pip/pgadmin4-6.11-py3-none-any.whl
pip install wheel
pip install pgadmin4-6.11-py3-none-any.whl
</code></pre>
<p>As I want to use the <code>Desktop</code> mode I created the <code>pgadmin4/lib/python3.9/site-packages/pgadmin4/config_local.py</code> file and I added according to my usual login user, <code>qgis</code>:</p>
<pre><code>SERVER_MODE = False
LOG_FILE = &apos;/home/qgis/.pgadmin/pgadmin4.log&apos;
SQLITE_PATH = &apos;/home/qgis/.pgadmin/pgadmin4.db&apos;
SESSION_DB_PATH = &apos;/home/qgis/.pgadmin/sessions&apos;
STORAGE_DIR = &apos;/home/qgis/.pgadmin/storage&apos;
</code></pre>
<p>Run <code>python pgadmin4/lib/python3.9/site-packages/pgadmin4/setup.py</code> and the setup should be completed.<br>
Depending on your setup, if you encounter permissions errors you should re-run the above command after you fix them.</p>
<p>You can test that everything works as it should by doing <code>python pgadmin4/lib/python3.9/site-packages/pgadmin4/pgAdmin4.py</code> and by opening your web browser to <a href="http://localhost:5050">http://localhost:5050</a></p>
<p><strong>Create a service</strong></p>
<p>Create a <code>/etc/systemd/system/pgadmin4.service</code> service file containing:</p>
<pre><code>[Unit]
Description=Pgadmin4 Service
After=network.target

[Service]
User=qgis
Group=qgis
WorkingDirectory=/home/qgis/Downloads/pgadmin4/
Environment=&quot;PATH=/home/qgis/Downloads/pgadmin4/bin&quot;
ExecStart=/home/qgis/Downloads/pgadmin4/bin/python /home/web/Downloads/pgadmin4/lib/python3.9/site-packages/pgadmin4/pgAdmin4.py
PrivateTmp=true

[Install]
WantedBy=multi-user.target
</code></pre>
<p>Run the service with <code>sudo systemctl start pgadmin4</code>.</p>
<p>Test if everything is fine by doing <code>sudo systemctl status pgadmin4</code>.</p>
<p>Set it up to autostart when linux boots by doing a <code>sudo systemctl enable pgadmin4</code>.</p>
<p>That&apos;s it!</p>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[Build python-qt4 from source on Debian testing]]></title><description><![CDATA[Learn how to build python-qt4 from source on Debian testing.]]></description><link>https://qtibia.com/build-python-qt4-on-debian-testing/</link><guid isPermaLink="false">5df4c06e220a78000194c385</guid><category><![CDATA[QGIS]]></category><category><![CDATA[debian]]></category><category><![CDATA[python]]></category><category><![CDATA[qt4]]></category><category><![CDATA[tutorial]]></category><category><![CDATA[install]]></category><dc:creator><![CDATA[Tudor Barascu]]></dc:creator><pubDate>Tue, 21 Jun 2016 05:50:15 GMT</pubDate><media:content url="https://qtibia.com/content/images/2021/06/build-python-qt4-form-source-on-debian-testing.png" medium="image"/><content:encoded><![CDATA[<!--kg-card-begin: markdown--><img src="https://qtibia.com/content/images/2021/06/build-python-qt4-form-source-on-debian-testing.png" alt="Build python-qt4 from source on Debian testing"><p>As QtWebKit Python bindings were <a href="https://lists.debian.org/debian-gis/2016/05/msg00030.html">removed from Debian Testing/Stretch</a> QGIS is unable to start with Python support and consequently with Python plugins.</p>
<p>Yes, there aren&apos;t many Debian Testing users in the GIS world, but there&apos;s a specific case for some with newer hardware.</p>
<p>If you have an Intel Skylake GPU in use like I do and you&apos;re using Linux then you probably already know preliminary support in the kernel has been only added since kernel version 4.3 with 4.4 supporting it fully.</p>
<p>Thus, you cannot use Debian Jessie or Ubuntu Trusty. Several months ago when I bought my current laptop the only viable option was Debian Testing and until this issue appeared it has served me without flaws. Now that Ubuntu Xenial (16.04), which is based on Debian Stretch, is in the open you can also work with it but it probably suffers from the same caveat.</p>
<p>The only solution is to build python-qt4 with WebKit support.</p>
<p>The steps are:</p>
<ul>
<li><code>sudo apt-get install bison cmake dh-python doxygen flex gdal-bin git graphviz grass-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl-dev libopenscenegraph-dev libosgearth-dev libpq-dev libproj-dev libqca2-dev libqca2-plugin-ossl libqjson-dev libqscintilla2-dev libqt4-dev libqt4-opengl-dev libqt4-sql-sqlite libqwt-dev libspatialindex-dev libspatialite-dev libsqlite3-dev lighttpd locales pkg-config poppler-utils python-all python-all-dev python-future python-gdal python-mock python-nose2 python-psycopg2 python-pyspatialite python-sip python-sip-dev python-yaml qt4-dev-tools qt4-doc-html spawn-fcgi txt2tags xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb cmake-curses-gui libqtwebkit-dev</code></li>
</ul>
<p>Note: From the normal qgis dependencies (see <a href="https://github.com/qgis/QGIS/blob/master/INSTALL">INSTALL</a> document) I removed the <code>pyqt4-dev-tools pyqt4.qsci-dev python-qscintilla2 python-qt4 python-qt4-dev python-qt4-sql</code> packages and I added the <code>libqtwebkit-dev</code> but you don&apos;t need to remove anything from the dependencies as they will simply be overwritten.</p>
<ul>
<li><a href="http://sourceforge.net/projects/pyqt/files/PyQt4/PyQt-4.11.4/PyQt-x11-gpl-4.11.4.tar.gz">Download PyQt</a></li>
<li>Extract the archive and cd to the directory with <code>tar -xvf PyQt-x11-gpl-4.11.4.tar.gz &amp;&amp; cd PyQt-x11-gpl-4.11.4</code></li>
<li>Configure with the option to also build the QSCIntilla api with <code>python configure-ng.py --qmake=/usr/bin/qmake-qt4 --qsci-api</code></li>
<li><code>make &amp;&amp; sudo make install</code></li>
<li><a href="http://sourceforge.net/projects/pyqt/files/QScintilla2/QScintilla-2.9.3/QScintilla_gpl-2.9.3.tar.gz">Download QScintilla</a></li>
<li>Extract the archive with <code>tar -xvf QScintilla_gpl-2.9.3.tar.gz</code></li>
<li>Cd to the <strong>Qt4Qt5</strong> subdirectory with <code>cd QScintilla_gpl-2.9.3/Qt4Qt5/</code></li>
<li><code>qmake-qt4 qscintilla.pro</code></li>
<li><code>make &amp;&amp; sudo make install</code></li>
<li>the Python bindings for QScintilla are in the <code>QScintilla_gpl-2.9.3/Python</code> directory so <code>cd ../Python</code> should get you there</li>
<li><code>python configure.py --qmake=/usr/bin/qmake-qt4</code></li>
<li><code>make &amp;&amp; sudo make install</code> should do the trick</li>
</ul>
<p>Congratulations, you have built python-qt4 with QtWebKit support + QScintilla with python bindings.</p>
<p>You can now build QGIS from source as you basically you have build from source what comes in the <code>pyqt4-dev-tools pyqt4.qsci-dev python-qscintilla2 python-qt4 python-qt4-dev python-qt4-sql</code> packages. All this with QtWebKit support, of course.</p>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[How to setup PyCharm for QGIS development]]></title><description><![CDATA[Learn how to setup PyCharm for QGIS development.]]></description><link>https://qtibia.com/how-to-setup-pycharm-for-qgis-development-under-linux-and-windows/</link><guid isPermaLink="false">5df4c06e220a78000194c37d</guid><category><![CDATA[QGIS]]></category><category><![CDATA[PyCharm]]></category><category><![CDATA[qgis build]]></category><category><![CDATA[tutorial]]></category><category><![CDATA[install]]></category><dc:creator><![CDATA[Tudor Barascu]]></dc:creator><pubDate>Thu, 09 Jun 2016 14:17:41 GMT</pubDate><media:content url="https://qtibia.com/content/images/2021/06/how-to-setup-pycharm-for-qgis-development.png" medium="image"/><content:encoded><![CDATA[<!--kg-card-begin: markdown--><img src="https://qtibia.com/content/images/2021/06/how-to-setup-pycharm-for-qgis-development.png" alt="How to setup PyCharm for QGIS development"><p>When running python commands in the QGIS console, you have some neat features: attribute auto complete, syntax highlighting etc.<br>
<img src="https://qtibia.com/content/images/2016/06/python_console.jpg" alt="How to setup PyCharm for QGIS development" loading="lazy"><br>
Naturally, everyone wants to have these features in their IDE of choice.</p>
<p>Let&apos;s see how it looks in PyCharm under Debian/Ubuntu.</p>
<p>After you create a new project:</p>
<p><img src="https://qtibia.com/content/images/2016/06/pycharm_new_project.png" alt="How to setup PyCharm for QGIS development" loading="lazy"></p>
<p>and create a <code>test.py</code> file with<br>
<code>from qgis.core import QgsDataSourceURI, QgsVectorLayer</code><br>
you may find out like I did that PyCharm may not recognize it:<br>
<img src="https://qtibia.com/content/images/2016/06/pycharm_problem.png" alt="How to setup PyCharm for QGIS development" loading="lazy"></p>
<p>You can see from the picture above that we have some red highlights that show that PyCharm is not so happy with what&apos;s written there.</p>
<p>By checking the console log of PyCharm I noticed the following:<br>
<code>.. WARN - .skeletons.PySkeletonRefresher - qgis._analysis  .. WARN - .skeletons.PySkeletonRefresher - qgis._core  .. WARN - .skeletons.PySkeletonRefresher - qgis._gui  .. WARN - .skeletons.PySkeletonRefresher - qgis._networkanalysis  .. WARN - .skeletons.PySkeletonRefresher - qgis._server </code><br>
I thought of solving it quickly so I went to <code>File --&gt; Settings --&gt; Project Interpreter</code> (you can also open this up by doing <code>CTRL + ALT + S</code>) and add to the interpreter paths the location of the QGIS Python modules which for me is: <code>/home/web/apps/share/qgis/python</code>.<br>
<img src="https://qtibia.com/content/images/2016/06/python_console-1.jpg" alt="How to setup PyCharm for QGIS development" loading="lazy"><br>
<img src="https://qtibia.com/content/images/2016/06/python_console-2.jpg" alt="How to setup PyCharm for QGIS development" loading="lazy"></p>
<p>Which should look finally like this:<br>
<img src="https://qtibia.com/content/images/2016/06/python.png" alt="How to setup PyCharm for QGIS development" loading="lazy"><br>
Trying to run the simple import script outputted:</p>
<pre><code>/usr/bin/python2.7 /home/web/PycharmProjects/untitled/test.py
Traceback (most recent call last):
  File &quot;/home/web/PycharmProjects/untitled/test.py&quot;, line 1, in &lt;module&gt;
    from qgis.core import QgsDataSourceURI, QgsVectorLayer
  File &quot;/home/web/apps/share/qgis/python/qgis/__init__.py&quot;, line 36, in &lt;module&gt;
    from qgis.core import QgsFeature, QgsGeometry
  File &quot;/home/web/apps/share/qgis/python/qgis/core/__init__.py&quot;, line 34, in &lt;module&gt;
    from qgis._core import *
ImportError: libqgis_core.so.2.14.3: cannot open shared object file: No such file or directory
</code></pre>
<p>Hmm...</p>
<p>As I was using a QGIS built from source but I hadn&apos;t setup globally or locally the path to the QGIS libraries the following step was doing just that.</p>
<p>So, moments later, after closing PyCharm, doing <code>export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/web/apps/lib</code> and reopening it with <code>./pycharm.sh</code> I ran the script again and the import was successful.</p>
<p>However, for some reason, PyCharm still was not able to build the skeletons of the QGIS modules so the main goal was still unmet.</p>
<p>I tried so many things to no avail among which I can recall:</p>
<ul>
<li>setting the PYTHONPATH outside PyCharm</li>
<li>installing older versions of PyCharm</li>
<li>clearing the PyCharm cache to force rebuild of skeletons by clicking <code>File --&gt; Invalidate Caches / Restart..</code> or by deleting the <code>~/.PyCharm2016.1/</code> and even the <code>~/PycharmProjects/</code></li>
<li>even went on Windows and see if I encounter the same problem which I did  but I solved it rather quickly by following the blogs of <a href="https://nathanw.net/2014/05/10/setting-up-pycharm-for-pyqgis-and-qt/">Nathan</a> and <a href="http://spatialgalaxy.net/2014/10/09/a-quick-guide-to-getting-started-with-pyqgis-on-windows/">Gary</a> which I&apos;ll sum up towards the end of this page.</li>
</ul>
<p>If you encounter this kind of problems you better begin and checkout the PyCharm <code>idea.log</code> file.</p>
<p>You can find the its location by going to <code>Help --&gt; Show Log in Files</code>.<br>
A <code>tail -f ~/.PyCharm2016.1/system/log/idea.log</code> proved useful for me as I could see what skeletons are updating and whether the QGIS modules are parsed or not.</p>
<h2 id="debianubuntusolution">Debian/Ubuntu solution</h2>
<p>Open the Python console from QGIS and run the following:</p>
<pre><code>import sys
print(sys.path)
</code></pre>
<p>It should output something like:</p>
<pre><code>[&apos;/home/web/apps/share/qgis/python/plugins/processing&apos;, &apos;/home/web/apps/share/qgis/python&apos;, u&apos;/home/web/.qgis2/python&apos;, u&apos;/home/web/.qgis2/python/plugins&apos;, &apos;/home/web/apps/share/qgis/python/plugins&apos;, &apos;/usr/lib/python2.7&apos;, &apos;/usr/lib/python2.7/plat-x86_64-linux-gnu&apos;, &apos;/usr/lib/python2.7/lib-tk&apos;, &apos;/usr/lib/python2.7/lib-old&apos;, &apos;/usr/lib/python2.7/lib-dynload&apos;, &apos;/home/web/.local/lib/python2.7/site-packages&apos;, &apos;/usr/local/lib/python2.7/dist-packages&apos;, &apos;/usr/lib/python2.7/dist-packages&apos;, &apos;/usr/lib/python2.7/dist-packages/PILcompat&apos;, &apos;/usr/lib/python2.7/dist-packages/gtk-2.0&apos;, u&apos;/home/web/.qgis2//python&apos;, &apos;/home/web/apps/share/qgis/python/plugins/fTools/tools&apos;]
</code></pre>
<p>Clean the output by:</p>
<ul>
<li>replacing <code>&apos;, &apos;</code> and <code>&apos;, u&apos;</code> with <code>:</code></li>
<li>delete the encompassing <code>[&apos;</code> and <code>&apos;]</code></li>
</ul>
<p>Now put it in a PYTHONPATH variable.</p>
<p>The final command should look like</p>
<pre><code>export PYTHONPATH=$PYTHONPATH:/home/web/apps/share/qgis/python/plugins/processing:/home/web/apps/share/qgis/python:/home/web/.qgis2/python:/home/web/.qgis2/python/plugins:/home/web/apps/share/qgis/python/plugins:/usr/lib/python2.7:/usr/lib/python2.7/plat-x86_64-linux-gnu:/usr/lib/python2.7/lib-tk:/usr/lib/python2.7/lib-old:/usr/lib/python2.7/lib-dynload:/home/web/.local/lib/python2.7/site-packages:/usr/local/lib/python2.7/dist-packages:/usr/lib/python2.7/dist-packages:/usr/lib/python2.7/dist-packages/PILcompat:/usr/lib/python2.7/dist-packages/gtk-2.0:/home/web/.qgis2//python:/home/web/apps/share/qgis/python/plugins/fTools/tools
</code></pre>
<p>If you built your QGIS from source don&apos;t forget to point to the libraries if there&apos;s nothing setup by doing <code>export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/web/apps/lib</code></p>
<p><strong>IMPORTANT!!!</strong></p>
<p>Before testing if it works don&apos;t forget to remove whatever skeletons etc. PyCharm did before by removing the <code>~/.PyCharm2016.1</code> directory as <code>File --&gt; Invalidate Caches / Restart..</code> in PyCharm did jack squat for me.</p>
<p>You can see it works now:<br>
<img src="https://qtibia.com/content/images/2016/06/python_console-3.jpg" alt="How to setup PyCharm for QGIS development" loading="lazy"></p>
<p>Groovy!</p>
<p>Now, depending on what you want:</p>
<ul>
<li>you can make a script that sets the variables and then runs Pycharm</li>
<li>add the variables to the <code>~/.bashrc</code></li>
<li>other ..</li>
</ul>
<p>As I want to have a PyCharm aware QGIS icon on desktop I created a file called <code>pycharm-qgis-lts.sh</code> in the PyCharm directory with the content described above:</p>
<pre><code>export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/web/apps/lib
export PYTHONPATH=$PYTHONPATH:/home/web/apps/share/qgis/python/plugins/processing:/home/web/apps/share/qgis/python:/home/web/.qgis2/python:/home/web/.qgis2/python/plugins:/home/web/apps/share/qgis/python/plugins:/usr/lib/python2.7:/usr/lib/python2.7/plat-x86_64-linux-gnu:/usr/lib/python2.7/lib-tk:/usr/lib/python2.7/lib-old:/usr/lib/python2.7/lib-dynload:/home/web/.local/lib/python2.7/site-packages:/usr/local/lib/python2.7/dist-packages:/usr/lib/python2.7/dist-packages:/usr/lib/python2.7/dist-packages/PILcompat:/usr/lib/python2.7/dist-packages/gtk-2.0:/home/web/.qgis2//python:/home/web/apps/share/qgis/python/plugins/fTools/tools
sh /home/web/Downloads/pycharm/bin/pycharm.sh
</code></pre>
<p>The last line executes the <code>pycharm.sh</code> script.<br>
I made the file executable for the owning user with <code>chmod u+x pycharm-qgis-lts.sh</code>.</p>
<p>In order to also see it as a Desktop application I followed the steps <a href="https://developer.gnome.org/integration-guide/stable/desktop-files.html.en">outlined here</a> and I created a  <code>pycharm-qgis-lts.desktop</code> file in the <code>~/.local/share/applications</code> directory with the content:</p>
<pre><code>[Desktop Entry]
Version=1.0
Type=Application
Encoding=UTF-8
Name=PyCharm QGIS LTS
Icon=/home/web/Downloads/pycharm/bin/pycharm.png
Exec=&quot;/home/web/Downloads/pycharm/bin/pycharm-qgis-lts.sh&quot;
Comment=Develop with pleasure!
Categories=Development;IDE;
Terminal=false
StartupWMClass=pycharm-qgis-lts
</code></pre>
<p>That&apos;s it!</p>
<h2 id="windowssolution">Windows Solution</h2>
<p>Create a <code>qgis_pycharm.bat</code> file with the following content:</p>
<pre><code>@echo off
SET OSGEO4W_ROOT=C:\OSGeo4W64
SET PYCHARM=&quot;C:\Program Files (x86)\JetBrains\PyCharm 2016.1.4\bin\pycharm.bat&quot;

call &quot;%OSGEO4W_ROOT%&quot;\bin\o4w_env.bat
call &quot;%OSGEO4W_ROOT%&quot;\apps\grass\grass-7.0.4\etc\env.bat
@echo off
path %PATH%;%OSGEO4W_ROOT%\apps\qgis\bin
path %PATH%;%OSGEO4W_ROOT%\apps\grass\grass-7.0.4\lib

set PYTHONPATH=%PYTHONPATH%;%OSGEO4W_ROOT%\apps\qgis\python
set PYTHONPATH=%PYTHONPATH%;%OSGEO4W_ROOT%\apps\Python27\Lib\site-packages
set QGIS_PREFIX_PATH=%OSGEO4W_ROOT%\apps\qgis

 
start &quot;PyCharm aware of QGIS&quot; /B %PYCHARM% %*
</code></pre>
<p>You may need to change your paths accordingly but this certainly works. I won&apos;t go into details but you can check <a href="https://nathanw.net/2014/05/10/setting-up-pycharm-for-pyqgis-and-qt/">Nathan&apos;s blog</a> or <a href="http://spatialgalaxy.net/2014/10/09/a-quick-guide-to-getting-started-with-pyqgis-on-windows/">Gary&apos;s blog</a> from which I got the main ideas.</p>
<p>Just running the file ensures you&apos;ll have a QGIS-modules aware PyCharm.</p>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[PostgreSQL crash on Centos/RHEL 7]]></title><description><![CDATA[Solution to PostgreSQL crash on Centos/RHEL 7.]]></description><link>https://qtibia.com/postgresql-crash-on-centos-rhel-7/</link><guid isPermaLink="false">5df4c06e220a78000194c37c</guid><category><![CDATA[PostgreSQL]]></category><category><![CDATA[QGIS]]></category><category><![CDATA[crash]]></category><category><![CDATA[centos]]></category><category><![CDATA[rhel7]]></category><dc:creator><![CDATA[Tudor Barascu]]></dc:creator><pubDate>Tue, 16 Feb 2016 06:29:51 GMT</pubDate><media:content url="https://qtibia.com/content/images/2021/06/postgresql-crash-on-centos-thel-7.png" medium="image"/><content:encoded><![CDATA[<!--kg-card-begin: markdown--><img src="https://qtibia.com/content/images/2021/06/postgresql-crash-on-centos-thel-7.png" alt="PostgreSQL crash on Centos/RHEL 7"><p>I&apos;ve been using PostgreSQL on CentOS for several years without a glitch.<br>
Since upgrading to CentOS 7.2 I experienced a crash for the first time.</p>
<p><code>PANIC: semop(id=..) failed: Invalid argument</code></p>
<p>While digging into the problem I noticed that the crashed happened all the time after a crontab script ran.<br>
Doing an Internet search revealed the problem is due to systemd 212 that came with Centos 7.2 as it has the feature of <strong>removing all IPC objects owned by a user if she or he fully logs out</strong>.</p>
<p>The solution is to set <code>RemoveIPC=no</code> in <code>/etc/systemd/logind.conf</code> and to  restart <code>systemd-logind</code> service to disable this.</p>
<p>This is why it&apos;s good to do LVM or VM snapshots before upgrading, to ensure you have a way to revert when things go wrong.</p>
<ul>
<li><a href="http://www.postgresql.org/message-id/flat/20151214224729.2624.99840@wrigleys.postgresql.org#20151214224729.2624.99840@wrigleys.postgresql.org">reference 1</a></li>
<li><a href="http://www.postgresql.org/message-id/4665.1450217815@sss.pgh.pa.us">reference 2</a></li>
</ul>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[Hints for reporting QGIS bugs]]></title><description><![CDATA[Learn how to find and report QGIS bugs in a professional manner.]]></description><link>https://qtibia.com/hints-for-posting-qgis-bugs/</link><guid isPermaLink="false">5df4c06e220a78000194c37e</guid><category><![CDATA[QGIS]]></category><category><![CDATA[bugs]]></category><category><![CDATA[report]]></category><dc:creator><![CDATA[Tudor Barascu]]></dc:creator><pubDate>Sun, 24 Jan 2016 14:14:13 GMT</pubDate><media:content url="https://qtibia.com/content/images/2021/06/hints-for-reporting-qgis-bugs.png" medium="image"/><content:encoded><![CDATA[<!--kg-card-begin: markdown--><img src="https://qtibia.com/content/images/2021/06/hints-for-reporting-qgis-bugs.png" alt="Hints for reporting QGIS bugs"><p>Like every software, QGIS has bugs and one of the many ways that people can contribute to QGIS is <strong>bug reporting</strong>.</p>
<p>Actually, I think that bug reporting and documentation translation and writing are one of the best ways to join the QGIS effort and contribute back to this nice community.</p>
<p>This post gives some hints on bug reporting and I would like to start it by simply saying that you should <strong>take your time</strong> when doing a bug report.<br>
By this I mean that you should give specific details and be as explicit as you can as in what conditions that bug appears.</p>
<p>You can checkout <a href="https://hub.qgis.org/wiki/17/Bugreports">https://hub.qgis.org/wiki/17/Bugreports</a> on more info about the bug reporting procedure.</p>
<p>The best way to present a QGIS bug is by <strong>accompanying your report with data</strong> and the exact steps that are needed to be done so that the issue can be easily reproduced.</p>
<p>I strongly believe that a good report (with data attached) makes a very good invite for any developer to check out the report. As developer time is as precious to him/her as everyone else&apos;s time the fact that you (the bug reporter) invested time so that the developer doesn&apos;t waste his/hers will probably get your bug checked out faster than others that are not detailed enough and can give headaches when trying to reproduce.</p>
<p>For vectors, you can save your data in <code>shapefile</code> or <code>sqlite</code> format.</p>
<p>However, keep in mind that it&apos;s best that you don&apos;t use the <code>shapefile</code> format for anything, including bug reporting.<br>
Although you can easily search for articles that say why I will just paste some of the <strong>why nots</strong> I could easily find:</p>
<ul>
<li><code>shapefiles have serious problems with attributes. For example, they cannot store null values, they round up numbers, they have poor support for Unicode character strings, they do not allow field names longer than 10 characters, and they cannot store both a date and time in a field. These are just the main issues</code></li>
<li><code>shapefiles do not work well for storing information in a language other than English</code></li>
</ul>
<p>So, although the shapefile format is widely used (inertia), I strongly recommend saving your portable data in the <code>sqlite</code> format instead of shapefiles. <strong>For anything!</strong></p>
<p>You can use the <code>Create SpatiaLite Layer</code> tool to do it:</p>
<p><img src="https://qtibia.com/content/images/2016/01/create_sqlite.gif" alt="Hints for reporting QGIS bugs" loading="lazy"></p>
<p>The created sqlite file is over 5.6MB in size as it contains all the coordinate systems definitions in it.</p>
<p>If you want to shrink it you can simple delete the CRS&apos;s that you don&apos;t use for your data by connecting with <strong>DB Manager</strong> to the database and by running the following query:</p>
<pre><code>DELETE FROM spatial_ref_sys WHERE srid &lt;&gt; 3844;
DELETE FROM spatial_ref_sys_aux WHERE srid &lt;&gt; 3844;
VACUUM;
</code></pre>
<p>Basically, the above queries delete all the CRS definitions other than the one that I am usually using, that has the <code>srid</code> of <code>3844</code>.<br>
Keep in mind that the Vacuum command is needed in order to shrink the database after the data is deleted.</p>
<p>You can see from the terminal output below to what amount the data shrinked:</p>
<pre><code>web@thinkpad:~/$ ls -al -h water.sqlite 
-rw-r--r-- 1 web web 5.6M Jan 24 16:05 water.sqlite

web@thinkpad:~/$ ls -al -h water.sqlite 
-rw-r--r-- 1 web web 667K Jan 24 16:07 water.sqlite

web@thinkpad:~/$ ls -al -h water.sqlite 
-rw-r--r-- 1 web web 128K Jan 24 16:11 water.sqlite
</code></pre>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[Gran Canaria QGIS Hackfest]]></title><description><![CDATA[The experience from my first QGIS hackfest in Gran Canaria, 2015.]]></description><link>https://qtibia.com/gran-canaria-qgis-hackfest/</link><guid isPermaLink="false">5df4c06e220a78000194c382</guid><category><![CDATA[QGIS]]></category><category><![CDATA[gran canaria]]></category><category><![CDATA[hackfest]]></category><category><![CDATA[2015]]></category><category><![CDATA[event]]></category><dc:creator><![CDATA[Tudor Barascu]]></dc:creator><pubDate>Tue, 10 Nov 2015 12:55:03 GMT</pubDate><media:content url="https://qtibia.com/content/images/2021/06/Gran-Canaria-QGIS-Hackfest.png" medium="image"/><content:encoded><![CDATA[<!--kg-card-begin: markdown--><img src="https://qtibia.com/content/images/2021/06/Gran-Canaria-QGIS-Hackfest.png" alt="Gran Canaria QGIS Hackfest"><p>I&apos;m back from my first <a href="https://hub.qgis.org/wiki/quantum-gis/14th_QGIS_Developer_Meeting_in_Gran_Canaria_2015">QGIS hackfest</a> and <strong>it was wonderful</strong>.</p>
<p>It was really interesting as I met a lot of nice people and we did good networking.</p>
<p>I didn&apos;t knew first as what to expect as I hadn&apos;t met anyone in person before and I was the only Romanian attending (actually the first to a QGIS hackfest). Nothing further from the truth as the community is great and the majority if not all the community members like to get in touch with newcomers.</p>
<p>Basically, we had great communication and we went out each night to grab a beer and we stood quite late each time.<br>
I think that a good connection was also enabled by the nice setup in Gran Canaria, with lots of things to do, and warm weather although it was the beginning of November. Having the possibility to staying the nights in t-shirts (more that 20 degrees) certainly contributed to a nice setup.</p>
<p>What really amazed me is that there were lots of people attending that were involved with GIS/Hydraulic modeling in the water/wastewater industry but somehow, they hadn&apos;t connected before and they didn&apos;t knew about each others interests.<br>
I already knew of course about the common interests of <a href="https://github.com/3nids">Denis Rouzaud</a> and <a href="https://github.com/m-kuhn">Matthias Kuhn</a> whom with we&apos;re working along in the <a href="https://github.com/qwat">QWAT</a> and <a href="https://github.com/qgep">QGEP</a> projects.<br>
I met <a href="https://github.com/daviderill">David Erill</a> and Carlos L&#xF3;pez Quintanilla that had strong ties with the <a href="http://giswater.org">giswater</a> project but there were also others that had similar interests.<br>
Even the organizers from the <a href="http://osl.ulpgc.es/">Office of Free Software</a> of the University of Las Palmas, represented by Pablo Fern&#xE1;ndez Moniz, were working along with students on practical projects for the local water company, which is a tremendous thing.</p>
<p>On a side node, it&apos;s a pity that we don&apos;t have tight collaboration between Romanian universities and companies that are involved in the matching industries. Some collaborations may exist, but to the best of my knowledge, they&apos;re the exception.</p>
<p>We did talk about combining our efforts and about the possibility of merging projects, data-models and so on. It would be very nice and productive for everyone to build a bigger water community around <a href="http://qgis.org">QGIS</a> so that the knowledge, coding and all the efforts are centralized.</p>
<!--kg-card-end: markdown-->]]></content:encoded></item></channel></rss>