Closed datadig2017 closed 6 years ago
Sorry I didn't specify my environment: Windows 7 Professional, 64 bit, QGIS 2.18; I will try to upgrade to QGIS 3.x to see if this would be corrected. Thanks!
This is an overall problem with how QGIS handles objects drawn across the international date line. It is not caused by shape tools. Several years ago I put in a bug fix request for this, but nothing ever happened. I think it is a hard problem to solve. The only way that I know of to fix this would be to break lines that cross the date line into two pieces. I don't know if the libraries I am using has a routine that tells when the line intersects the date line or not, but I will investigate it.
Thanks for following up! I understand that this is a tough ball. I compile this kind of map for work and there is quite a few instances of connections between Fiji, Samoa, Tonga, Vanuatu, Australia, etc. Once I remove those, the lines look good. I wonder if the "great circle" mechanism within "Shape Tools" would first measure the distance and the direction for each line and decide if it crosses the IDL. If it does, the algorithm would implement a "complementary" arc. For example, the connection from Fiji to Samoa crosses the IDL, according to the current rendition. If using the reverse direction, it is just a tiny short distance. Anyway, no big deal. I can always manually flip those connections from my source CSV file before importing into QGIS. "Shape Tools" is a great tool! Many thanks!!
I'm working on a solution which will break the line at the -180, 180 boundary and continue drawing it. Unfortunately, geographiclib does not have a function to detect the intersection of a line crossing another line and it is quite complicated at least for me. There is one algorithm that I have found and am in the process of implementing it. It might take a few days before I complete the update and get it out.
Happy to share my CSV file for your testing! Let me know. Thanks!
That would be helpful. Thanks.
Here is the Excel file. Surprised that Github doesn't take CSV format. The column headings are self-explanatory. Pay attention to lines originating from FJI, WSM and/or ending in FJI WSM VUT. Those small islands are in the vicinity of IDL.
Again, many thanks for working on this great tool!
test.tools.github.xlsx Hi I realized that the previous file shared doesn't have connections that cross the IDL. I have already removed them. I am sharing again with this version where there are connections that cross IDL. Sorry for the confusion.
@datadig2017 I just release Shape Tools 3.0.9 for QGIS 3. The XY to Line tool now has an option to "Break lines at -180, 180 boundary..." Be sure to enable it. It worked properly on the data set you sent me so give it a try and let me know how it goes.
Thank you so much for updating the tool! Can't wait to test it. Let me update to QGIS 3 first. Will let you know the test results soon.
@hamiltoncj Thanks again for updating the tool. The additional option of "Break lines at -180, 180..." works well in rendering long lines (regardless of crossing IDL or not). A few quick observations:
I used a layer where I have removed lines that known to cross IDL and didn't check "break lines" option and quite a few lines looked not right (although they don't actually cross the IDL). I tried again with the "break lines" option checked and all lines look great. I guess this is expected? I will by default check this option always.
Although my input layer is [EPSG:4326], the default input CRS for coordinates within the vector files is always EPSG:3857 - WGS 84/ Pseudo-Mercator. I am not sure this is correct. Actually my first try using this default CRS resulted in an empty output line layer. When I manually change the CRS to [Default CRS: EPSG: 4326 - WGS 84] the output line layer looked OK.
The default loaded setting for Output point layer is [skip output], although both "show starting point" and "show ending point" options are checked. After the program is complete, I only have the Output line layer. So on the next try, I clicked on the "..." button to manually select Output point layer to be [create temporary layer] and also checked "open output file after running algorithm" (which was grayed out if [skip output] was selected). Now I have an output point layer, but it is blank. The output point function was working pretty OK in the previous version.
Let me know if you need screenshots. I don't want to overwhelm you with screenshots. Hopefully my description above is clear.
Item 1 - I don't understand why something is not right. Are you sure you don't have any that cross the IDL. You could also try it in QGIS 2. It can also look funny crossing over the poles depending on the projection you are using.
Item 2 - By making XY to Lines a processing routine I get a number of advantages; however, some things are not as flexible. By default it is using the CRS of the QGIS project which I suspect is 3857. I couldn't find a way to make it just use the Layer CRS. I could however have it default to 4326. Since I am often using 3857 it has been a little annoying for me as well. What do you think? Should the default be 4326?
Item 3 - If the CRS is not correct then the points will not be in the right place. They may be what is happening. Do you think the output point layer should be enabled by default as a temporary layer?
I see the problem for #3. I will fix it.
Interesting... Item 1 - Enabling the "break lines" option works great anyway. I will always check it so there is no problem. Item 2 - Would be good to default to 4326 (or 3857) just for convenience. It doesn't matter though. I can always manually select 4326. Item 3 - Yes, please default the output point layer as temporary layer instead of [skip output], especially when "show starting point" and "show ending point" are by default selected. Previously the output point layer was fine and I saved it. Screenshot below shows it is CRS 4326, the same as specified output layer CRS.
Not sure what changed in this version that "blanked" the output point layer. Could you test?
Our posts crossed each other. Great that you sorted out problem 3. Thanks as always!
I just released 3.0.10. It may take a few minutes for plugins.qgis.org to update their listing. Usually it is not more than about 15 minutes. I have made EPSG:4326 the default and the beginning and ending points output file enabled by default. Once you can update, let me know how it works out for you.
Sure. Thanks!
I updated the QGIS 2 plugin with this fix. It is version 0.7.9
Hi version 3.0.10 works great! The output point layer functions smoothly. Kudos! Many thanks!
@datadig2017 I am going to close this out, but wanted to make you aware that I found a bug XY to Line. It is fixed in 3.1.0. Also I created a separate routine to break the lines. If there are any other issues please let me know.
Thx @hamiltoncj! I’m on leave now. Will test the new version when back in September! Cheers!
The XY-Line tool works great for creating "great-circle" flow map lines (those seen in air flight maps). However when the lines cross international date line, they seem to extend across the entire canvas. Anita Graser [Underdark] also noted this in her blog (https://anitagraser.com/2011/08/20/visualizing-global-connections/) but she didn't give an answer/solution.