mauroalberti / qProf

Python plugin for QGIS, to create topographic and geological profiles
GNU General Public License v3.0
25 stars 3 forks source link

incorrect prof_id assignment if generating over a threshold number of profiles from polyline shapefile? #10

Closed wobrotson closed 5 years ago

wobrotson commented 5 years ago

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.

mauroalberti commented 5 years ago

Ciao, If you could provide the dataset it would help me understand the problems..

Thanks, mauro

Il gio 26 lug 2018, 14:54 wobrotson notifications@github.com ha scritto:

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', and 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.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mauroalberti/qProf/issues/10, or mute the thread https://github.com/notifications/unsubscribe-auth/ABi_7ru0NwLjaaQ8t8ybhZiuYIxvr9l9ks5uKbwIgaJpZM4VhxAv .

wobrotson commented 5 years ago

Hi Mauro, I have sent you an email with a link to the files in a compressed zip folder.

cheers, Rob

mauroalberti commented 5 years ago

I've seen, thanks. Since the dataset is not so small, I will have to wait until tomorrow trying to download it.

ciao, mauro

On Fri, Jul 27, 2018 at 6:35 PM, wobrotson notifications@github.com wrote:

Hi Mauro, I have sent you an email (to alberti.m65@gmail.com) with a link to the files in a compressed zip folder.

cheers, Rob

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mauroalberti/qProf/issues/10#issuecomment-408472401, or mute the thread https://github.com/notifications/unsubscribe-auth/ABi_7v9ZXZwBv7Qfc77S3o4TQ3IoT276ks5uK0E3gaJpZM4VhxAv .

wobrotson commented 5 years ago

I just tried to process the same data in the latest release for QGIS 3, the same result occurred.

mauroalberti commented 5 years ago

As of now, I was not able to access your dataset,so the QGIS3 version is just the porting of the previous one.

You did check the "layer has multiple profiles" and also set the "line order field" value, correct?

Currently, the "line order field" is used for the creation of a single profile merging the lines on the increasing values extracted from the field. This is useful since there are cases where the lines composing the profile have an order, in the attribute table, that is different from a sequential one from a geographic perspective.

If you check "Layer has multiple profiles", it is assumed that each feature is already a single, complete and geographically correct profile, and the current extraction order is derived from the progressive position in the attribute table, not from the "line order" field (unused in this case).

If the problem is this one, I would modify the implementation to use the line order field choice for ordering multiple profiles, when both the "layer has multiple profiles" and the "line order field" are set.

ciao, mauro

On Mon, Jul 30, 2018 at 12:10 PM, wobrotson notifications@github.com wrote:

I just tried to process the same data in the latest release for QGIS 3, the same result occurred.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mauroalberti/qProf/issues/10#issuecomment-408814637, or mute the thread https://github.com/notifications/unsubscribe-auth/ABi_7nTD54x85zWeqc21kY1yxVN8TJO1ks5uLtuVgaJpZM4VhxAv .

wobrotson commented 5 years ago

I checked 'layer has multiple profiles', and also set the line order id to be my 'id' attribute in the shapefile, and the order is still incorrect. I have tried only checking the box 'layer has multiple profiles', and it still performs it incorrectly.

Are you saying that I should not check the 'layer has multiple profiles' box and only set the line order id?

mauroalberti commented 5 years ago

I am saying that what you are looking for is still to be implemented. The results that you are obtaining by setting the "multiple profile" option are (very probably) correct under the current implementation: multiple profiles with their id given by the order of the feature in the attribute table, not by the line order field that has another, completely different purpose. If you set "multiple profiles" the "line order field" is currently ignored, since it refers only to the merging of different lines into a single profile, not regulating the plot order of multiple profiles. I would implement this new feature but probably not before next week end.

wobrotson commented 5 years ago

Ah I see, sorry for the confusion. that's great, thanks very much for your help.

mauroalberti commented 5 years ago

Could you please check if v. 0.4.1 RC 1 solves the discussed problem?

https://github.com/mauroalberti/qProf/releases/tag/v0.4.1RC1

Thanks, mauro

On Mon, Jul 30, 2018 at 7:30 PM, wobrotson notifications@github.com wrote:

Ah I see, sorry for the confusion. that's great, thanks very much for your help.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mauroalberti/qProf/issues/10#issuecomment-408945441, or mute the thread https://github.com/notifications/unsubscribe-auth/ABi_7kMzXJSsvlpz1GEOCpIO7Wb3B05Sks5uL0LCgaJpZM4VhxAv .

wobrotson commented 5 years ago

I have downloaded and extracted the code to the usual folder:

C:\Users\MyUsername\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\qProf-0.4.1RC1

after uninstalling the old release for QGIS3, release 0.4.0.

however, on trying to install the plugin from plugin manager I get the following error message:

Couldn't load plugin 'qProf-0.4.1RC1'

ModuleNotFoundError: No module named 'qProf-0' Traceback (most recent call last): File "C:/PROGRA~1/QGIS3~1.0/apps/qgis/./python\qgis\utils.py", line 311, in loadPlugin import(packageName) File "C:/PROGRA~1/QGIS3~1.0/apps/qgis/./python\qgis\utils.py", line 664, in _import mod = _builtin_import(name, globals, locals, fromlist, level) ModuleNotFoundError: No module named 'qProf-0'

Python version: 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)] QGIS version: 3.0.3-Girona Girona, 8a899c8758

mauroalberti commented 5 years ago

Name of the plugin folder has to be qProf, not qProf-0.4.1RC1 Eventually uncompress, rename and recompress to achieve the correct folder name

On Wed, Aug 1, 2018 at 12:40 PM, wobrotson notifications@github.com wrote:

I have downloaded and extracted the code to the usual folder:

C:\Users\Rob Watson\AppData\Roaming\QGIS\QGIS3\profiles\default\python\ plugins\qProf-0.4.1RC1_

however, on trying to install the plugin from plugin manager I get the following error message:

_Couldn't load plugin 'qProf-0.4.1RC1'

ModuleNotFoundError: No module named 'qProf-0' Traceback (most recent call last): File "C:/PROGRA1/QGIS31.0/apps/qgis/./python\qgis\utils.py", line 311, in loadPlugin import(packageName) File "C:/PROGRA1/QGIS31.0/apps/qgis/./python\qgis\utils.py", line 664, in _import mod = _builtin_import(name, globals, locals, fromlist, level) ModuleNotFoundError: No module named 'qProf-0'

Python version: 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)] QGIS version: 3.0.3-Girona Girona, 8a899c8758_

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mauroalberti/qProf/issues/10#issuecomment-409531889, or mute the thread https://github.com/notifications/unsubscribe-auth/ABi_7rs_zA03xoKschvd6zwtMdyaW8_Nks5uMYWIgaJpZM4VhxAv .

wobrotson commented 5 years ago

It seems to have worked! Thats great, I am very grateful.

mauroalberti commented 5 years ago

Good, so I can release it as a new version..

ciao, mauro

On Wed, Aug 1, 2018 at 12:52 PM, wobrotson notifications@github.com wrote:

It seems to have worked! Thats great, I am very grateful.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mauroalberti/qProf/issues/10#issuecomment-409534860, or mute the thread https://github.com/notifications/unsubscribe-auth/ABi_7tZ9nDymwxWsu3kx3mVRYcV9AQh1ks5uMYhvgaJpZM4VhxAv .

mauroalberti commented 5 years ago

Released improved version as 0.4.1.