mauroalberti / qprof Goto Github PK
View Code? Open in Web Editor NEWPython plugin for QGIS, to create topographic and geological profiles
License: GNU General Public License v3.0
Python plugin for QGIS, to create topographic and geological profiles
License: GNU General Public License v3.0
I cannot install qProf plugin, I receive the message: "ImportError: No module named urllib.request".
In the directory "Python36" there are the directories and file "Python36\Lib\urllib\request.py"!
Where could be the problem?
Couldn't load plugin 'qProf'
ImportError: cannot import name NavigationToolbar2QTAgg
Traceback (most recent call last):
File "/usr/local/qgis-2.16/share/qgis/python/qgis/utils.py", line 308, in loadPlugin
import(packageName)
File "/usr/local/qgis-2.16/share/qgis/python/qgis/utils.py", line 607, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/home/gavin/.qgis2/python/plugins/qProf/init.py", line 24, in
from qProf_gui import qProf_gui
File "/usr/local/qgis-2.16/share/qgis/python/qgis/utils.py", line 607, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/home/gavin/.qgis2/python/plugins/qProf/qProf_gui.py", line 5, in
from qProf_QWidget import qprof_QWidget
File "/usr/local/qgis-2.16/share/qgis/python/qgis/utils.py", line 607, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/home/gavin/.qgis2/python/plugins/qProf/qProf_QWidget.py", line 49, in
from mpl.mpl_widget import MplWidget, plot_line, plot_filled_line
File "/usr/local/qgis-2.16/share/qgis/python/qgis/utils.py", line 607, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/home/gavin/.qgis2/python/plugins/qProf/mpl/mpl_widget.py", line 19, in
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg as NavigationToolbar
ImportError: cannot import name NavigationToolbar2QTAgg
Python version: 2.7.12 (default, Jul 1 2016, 15:12:24) [GCC 5.4.0 20160609]
QGIS version: 2.16.0-Nødebo Nødebo, b09eef1
Ubuntu xenial
I'm running qProf in QGIS 2.14.12 and 2.18.3. I have a polyline layer with 20 records and need to generate a profile for each line in the dataset. It would be nice if I could set the source DEM and polyline layer once and then generate all the profiles. However, to generate a profile I need to reset the source DEM and line layer each time I select one of the lines.
So, is it possible to save the defined sources once for the session?
And (or) is it possible to batch create a profile for each feature in the input line layer and output as Shp/Image/CSV?
QGIS on macOS uses GDAL 3.2.1 that removed the deprecated import of GDAL, please see https://pypi.org/project/GDAL/
To support macOS 3.16 LTR and macOS 3.18, please fix the code with:
try:
from osgeo import gdal
except ImportError:
import gdal
detto for from ogr, osr,gdal_array and gdalconst imports
details: qgis/QGIS-Mac-Packager#114
Hi, I like your plugin, i was wondering have you considered adding a feature to plot the depths of earthquake hypocenters projected along the cross section line? This could be very helpful.
Hello
I would like to report a disagreement between qProf and QGIS please. The error message reads:
Couldn't load plugin 'qProf'
ImportError: dlopen(/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/Pillow-7.2.0-py3.8-macosx-10.13.0-x86_64.egg/PIL/_imaging.cpython-38-darwin.so, 2): Library not loaded: /opt/X11/lib/libxcb.1.dylib Referenced from: /Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/Pillow-7.2.0-py3.8-macosx-10.13.0-x86_64.egg/PIL/_imaging.cpython-38-darwin.so Reason: image not found
Traceback (most recent call last):
File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 312, in loadPlugin
import(packageName)
File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 793, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/Users/phillipburton/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/qProf/init.py", line 26, in
from .qProf_main import qProf_main
File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 793, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/Users/phillipburton/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/qProf/qProf_main.py", line 14, in
from .qProf_QWidget import qprof_QWidget
File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 793, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/Users/phillipburton/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/qProf/qProf_QWidget.py", line 25, in
from .qProf_plotting import *
File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 793, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/Users/phillipburton/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/qProf/qProf_plotting.py", line 12, in
from .mpl_utils.mpl_widget import MplWidget, plot_line, plot_filled_line
File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 793, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/Users/phillipburton/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/qProf/mpl_utils/mpl_widget.py", line 11, in
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 793, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/matplotlib-3.3.0-py3.8-macosx-10.13.0-x86_64.egg/matplotlib/backends/backend_qt5agg.py", line 10, in
from .backend_agg import FigureCanvasAgg
File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 793, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/matplotlib-3.3.0-py3.8-macosx-10.13.0-x86_64.egg/matplotlib/backends/backend_agg.py", line 35, in
from PIL import Image
File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 793, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/Pillow-7.2.0-py3.8-macosx-10.13.0-x86_64.egg/PIL/Image.py", line 94, in
from . import _imaging as core
File "/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 793, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
ImportError: dlopen(/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/Pillow-7.2.0-py3.8-macosx-10.13.0-x86_64.egg/PIL/_imaging.cpython-38-darwin.so, 2): Library not loaded: /opt/X11/lib/libxcb.1.dylib
Referenced from: /Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/Pillow-7.2.0-py3.8-macosx-10.13.0-x86_64.egg/PIL/_imaging.cpython-38-darwin.so
Reason: image not found
Python version: 3.8.7 (default, Feb 10 2021, 09:04:08) [Clang 12.0.0 (clang-1200.0.32.29)]
QGIS version: 3.16.8-Hannover Hannover, 8c50902ea4
Python Path:
/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python
/Users/phillipburton/Library/Application Support/QGIS/QGIS3/profiles/default/python
/Users/phillipburton/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins
/Applications/QGIS-LTR.app/Contents/MacOS/../Resources/python/plugins
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/pyproj-2.6.0-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/lib-dynload
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/GDAL-3.2.1-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/click_plugins-1.1.1-py3.8.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/rasterio-1.1.5-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/geopandas-0.8.1-py3.8.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/numba-0.50.1-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/cftime-1.2.1-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python38.zip
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/statsmodels-0.11.1-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/numpy-1.20.1-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/patsy-0.5.1-py3.8.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/matplotlib-3.3.0-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/scipy-1.5.1-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/opencv_contrib_python-4.3.0.36-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/affine-2.3.0-py3.8.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/Rtree-0.9.4-py3.8.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/Pillow-7.2.0-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/pandas-1.1.0-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/Fiona-1.8.13.post1-py3.8-macosx-10.13.0-x86_64.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/snuggs-1.4.7-py3.8.egg
/Applications/QGIS-LTR.app/Contents/MacOS/lib/python3.8/site-packages/netCDF4-1.5.4-py3.8-macosx-10.13.0-x86_64.egg
/Users/phillipburton/Library/Application Support/QGIS/QGIS3/profiles/default/python
QGIS 3.34.3, qProf 0.5.1, Mac OSX 10.13/6 (High Sierra)
Project: EPSG:3614 NAD83(NSRS2007) / New Hampshire (ftUS)
Using a DEM with 5.5' x 5.5' pixels
Using a line shape file containing a single ~ 36,000' long RR track {i.e., gentle curves and slopes}
Setting "line densify distance" = 22 {i.e., 4 DEM pixels} to reduce # of points
I get reasonable statistics:
Statistics for profile # 1
Length: 35697.751784624925
Topographic elevations
- min: 426.71148553760935
- max: 720.9710075441237 elevations
elevations
min: 426.71148553760935
max: 720.9710075441237
mean: 581.3510160958499
variance: 7193.706459598757
standard deviation: 84.81572059234513
Sampling points (2324) for profile # 1 {averaging 15.36'}
The graph looks OK
However, when I export as .csv and look at the data, the spacing varies wildly.
I'm calculating the Euclidian distance between adjacent points, i.e., sqrt(∆X^2+∆Y^2).
Summing all those distances matches the reported length, so the math is OK
the spacing begins with
11.92, 22.00, 10.65, 22.00, 22.00, 4.73, 22.00, 22.00, 16.16, 22.00,
by midways I'm seeing
22.00, 2.25, 22.00, 0.90, 20.83, 18.03, 14.51, 18.82, 22.00, 7.75,
the last spaces are
11.28, 12.28, 13.03, 13.53, 13.79, 13.80, 13.58, 13.10, 12.40, 11.46
In another test, I used the same line, made new layers with the line shifted West 20' and another shifted East 20'.
This produced 3 layers, each containing lines of identical length and shape except for the sideways shift.
running qProf with the same settings on the shifted lines
the line shifted +20' results in 3014 points along 35,715.8', with point spacing averaging 11.85'
beginning: 11.92, 22.00, 10.65, 22.00, 22.00, 4.73, 22.00, 22.00, 16.16, 22.00,
ending: 0.18, 13.80, 0.26, 13.58, 0.36, 13.10, 0.50, 12.40, 0.69, 11.46
the line shifted -20' results in 2995 points along 35,679.6', with point spacing averaging 11.91'
beginning: 11.92, 22.00, 10.65, 22.00, 22.00, 4.73, 22.00, 22.00, 16.16, 22.00,
ending: 12.28, 0.04, 13.01, 13.46, 13.65, 13.58, 13.26, 12.67, 11.80, 11.11
These length differences match QGIS' "Identify results" values, but are rather unexpected given that the 3 lines are identical except for the shifting. I thought that, perhaps, the 3d distances were being used, but my 2D Euclidian distances exactly match, so that can't be the issue.
I was hoping to be able to classify the RR bed as being
above adjacent terrain
below adjacent terrrain
on a slope
by comparing the elevations 20' to the left and right of the centerline.
But the wild variability in the point spacing defeated my goal.
I am attaching the 3 layers so you can test them yourself.
Cordially,
Garth Fletcher
layers.zip
Request 1:
To be able to project/intersection geology when I specify a profile line with multiple points
Request 2:
To be able to project/intersection geology when I have a layer of multiple profiles. This could be a layer with multiple profile lines which all have just 2 points, i.e. to create multiple projections as can be done already... or also do as "request 1".
Thankyou for working on qProf and making it available!
Hi Mauro,
Just to put a context around the error let me introduce myself. I'm Lluís from the GIS and Remote Sensing Service of the University of Girona and I'm a professor of the UNIGIS Msc. In the Geographic Analysis module my students are working on an assignment and they have to generate a topographic profile of the terrain.
I did recommend them the use of qProf but unfortunately some of them have experienced some problems and errors. One of my students tries to generate a profile from a route but it takes a lot of time and he coudn't get any result. QGIS freezes. Two days ago he get and error during the process and the plugin crashed. Now, when he tries to re-install the plugin he get the following error and he can't no longer install it. There is the error message attached.
Do you know where is the problem? Any hint?
Thanks in advance!
Cheers,
Lluís
error_qprof.txt
hello,
tryng qgis to create a geolgical section, i looking for a tool under linux to draw inside the the profile that i have created without export to another app to design a geological section.
it is possible to add a new feature to the plugin with a pencil like to design inside the profile?
do you know a method inside qgis?
best regards
marks
Hello, I have been trying to process a poly-line shapefile in QGIS using your plugin. The first time I ran the plugin, the profile had 106 lines. I specified the line order field as 'id', an integer feature class running from 1 - 106, and processing worked as expected, with each profile (when plotted in matlab from an exported csv file) corresponding to that drawn using the 'Profile' plugin in QGIS. I then performed the same analysis on other polyline shapefiles with 38 and 76 features respectively, again with success.
Later, I came to add further features to the initial polyline shapefile so that rather than having 106 it now had 301 features. I extracted the profiles again using qProf plugin, and the feature incorrectly assigned the id of the features, so that in the csv file the profiles generated no longer matched those specified in the 'id' feature class of the initial polyline shapefile. I plotted a shapefile of the same data generated by qprof and there seemed to be no pattern to the assignment of id to the lines. I tried splitting the shapefile into 3 smaller shapefiles each with 100 features (ids of 1-100, 101-200, 201-301 respectively). The same result occurred, with the incorrect assignment of the prof_id in the csv file generated. The incorrect result for the first smaller shapefile (first 100 features) was the same as the incorrect result as when I tried on the shapefile with all 301 features present.
If you can identify a reason and possible fix for this I would be very grateful. I can supply the relevant files if needed.
The title describes my issue, I can provide the dump file generated if needed.
Dear Mauro,
In the same context of my previous issue, another student get a new error trying to get a topographic profile based on a DEM and a vector line (route). The error information is attached as an image.
By the way, I've recorded a video about the process that the students should do to get the topographic profile. This is the exact process that takes me less than a minute to do, but some of them have to wait for dozens of minutes to do it... Is it a problem of RAM/Processor?
I noticed a slightly "unexpected" behaviour in version 0.5, not present in version 0.4.4.
the user need to press Define polygon style
prior to Intersect
in the polygon intersection dialog. Otherwise there is an unhandled KeyError that qProf does not intercept correctly.
This behaviour is unexpected for 1) the unhandled exception 2) in version 0.4.4 it was working differently (so the user would expect the same behavior).
When the user performs a polygon intersection the dictionary holding the unit-to-color conversion (i.e. the content of plot_addit_params["polygon_class_colors"]
) is empty until the user presses Define polygon style
and accepts the style.
It is my understanding that this step was not needed in version 0.4.4. So I thought this is an unwanted effect of latest changes worth of reporting.
The issue I believe is that if the user do not perform the color assignment by hand the qProf raises a KeyError as it is then assuming the dict is populated correctly. As this error does not help much the user in understanding what he/she is missing the default behaviour could be to just generate the default color mapping.
btw, going through the code I noticed there is a check in place:
if plot_addit_params["polygon_class_colors"] is None:
color = "red"
else:
print(plot_addit_params["polygon_class_colors"])
color = plot_addit_params["polygon_class_colors"][str(classification)]
as the plot_addit_params["polygon_class_colors"]
dict is present but empty the color red is never used in place of the color style. That's why then the KeyError is raised later.
I'd suggest to change it to:
if not plot_addit_params["polygon_class_colors"]:
color = "red"
else:
print(plot_addit_params["polygon_class_colors"])
color = plot_addit_params["polygon_class_colors"][str(classification)]
this way plot_addit_params["polygon_class_colors"]
will evaluate to False
both in case the dict is empty or None.
btw I see version 0.5 is not present here. Is it developed somewhere else now?
Hope it helps
Best, and thank you for this plugin!
Luca
Test this gpx.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.