Posts

Showing posts with the label qgis

QGIS: How to solver issues to import view layers from sql

If you want to add to QGIS sql sentences, an easy way is to create views. You only need to convert your sql sentence like: select geom from links to create or replace view v_links as select geom from links But, you probably see the following error: Layer is not valid: The layer dbname='' host=0.0.0.0 port=5432 user='' password='' sslmode=disable key='""' type=Point table="public"."v_links" (point) sql= is not a valid layer and can not be added to the map. Reason:  This issue is because an index doesn't exist for data To solve it, just create an index as follows: create or replace view v_links as select row_number() OVER (order by geom), geom from links Enjoy it!

Get raster values for points in a map with QGIS

Image
To get raster values you need to install "Point sampling Tool" from plugins list. Next, you must create a layer with points over the pixels from your raster layer. If you click on "Point sampling Tool" icon or from Plugins/Analyses option you would get raster values from each vectorial points. As you see in the image, each point is in a different raster color, therefore each one has an own value. Enjoy!

How to install Qgis3.2 + Grass7 + PGAdmin4 + Postgres11 + Postgis2.5 in Ubuntu Bionic

To start the installation, you must to add the following lines to your /etc/apt/sources.list file: # qgis deb http://qgis.org/debian bionic main deb-src http://qgis.org/debian bionic main # pgadmin4 deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main 11 Now, you need to get the repositories keys with the following sentences: # qgis gpg --keyserver keyserver.ubuntu.com --recv CAEB3DC3BDF7FB45 gpg --export --armor CAEB3DC3BDF7FB45 | sudo apt-key add - # pgadmin4 wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - Now, proceed with installation: sudo apt-get update sudo apt-get upgrade sudo apt-get install postgresql postgresql-contrib postgresql-11-postgis-2.5-scripts pgadmin4 qgis python-qgis qgis-plugin-grass -y To configure postgres, we procced to create a database with a postgres user: sudo -u postgres createdb testing psql -d testing -c "create extension postgis" Probably you wi...

How to find the shortest path from an Internet Zoo topology file throught Postgis/pgrouting

Image
First, you need to download a topology from Internet zoo. I will use Napnet as example: wget  http://www.topology-zoo.org/files/Napnet.graphml Now, we need to convert graphgml to sql (to load from postgres). To do it, you can use simplekml library for python or pykml. It's important use geographic coordinates without altitude value and only write edges in the kml file. After, you can follow this post  to convert from kml to sql. To begin, first we need to create a database and create a password (usually is postgres) for postgres user: sudo -u postgres createdb testing sudo -u postgres psql   postgres=# \password postgres Enter new password:  Enter it again:  postgres=# \q Now, load the sql query: psql -U postgres -d testing -q -f "Napnet.sql" psql: FATAL:  Peer authentication failed for user "postgres" To avoid this issue, you can run it throught this way: psql 'host=localhost port=5432 dbname=testing user=postgres' -q -f ...

How to install Qgis 3.0.x in Ubuntu 18.04

Image
If you try to install from repositories, you will install version 2.18 To install the lastest version, you can download it from git, but first you need to install dependencies. If you have Ubuntu 18.04 you need the following packages: sudo apt-get install bison ca-certificates ccache cmake cmake-curses-gui dh-python doxygen expect flex gdal-bin git graphviz grass-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl-dev libosgearth-dev libpq-dev libproj-dev libqca-qt5-2-dev libqca-qt5-2-plugins libqt5opengl5-dev libqt5scintilla2-dev libqt5sql5-sqlite libqt5svg5-dev libqt5webkit5-dev libqt5xmlpatterns5-dev libqwt-qt5-dev libspatialindex-dev libspatialite-dev libsqlite3-dev libsqlite3-mod-spatialite libzip-dev lighttpd locales ninja-build pkg-config poppler-utils pyqt5-dev pyqt5-dev-tools pyqt5.qsci-dev python3-all-dev python3-dateutil python3-dev python3-future python3-gdal python3-httplib2 python3-jinja2 python3-markupsafe python3-mock python3-nose2 python3-owslib python3-pl...