Open stepanoslejsek opened 21 hours ago
Hi, I don't think this error has anything to do with the old #59. Now, the install process is very different. But regarding the error, I need a way to reproduce it. Can you isolate the the first call of this line in a MWE?
distance_to_track = mapproject(map_point, dist2line=tram_route_matrix).data[3]
That said, your approach will be extremely slow. Calling mapproject
a _huge number of times, once per point, _is not the way. The way would be to call it once with all the points.
Also, you don't need all that complication introduced by reading the data with GeoIO, GeoTables, etc. gmtread
should do all that is needed with the plus that data comes already inside a GMTdaset.
But still furthermore. If you want to isolate the points that are at a certain distance to the railway, use the buffer
function to obtain that polygon and use it with inpolygon
to isolate those points.
I knew that there should be more efficient way, how to do such thing. Since I am not that much familiar with GMT.jl. The reason that I use GeoTables is the ease of performing a lot of dataprocessing and geometry manipulation on files representing the tram track (also a .geojson files), since it is essentially an 'extended DataFrame'. Also, the next step is going to do some spatial interpolation, which is supported by GeoStats.jl. I'll consider using GMT.jl and GMTdatasets.
Regarding the MWE for the first call, I could reproduce it with the code from https://discourse.julialang.org/t/how-to-calculate-the-nearest-point-on-a-line-to-a-given-point/105743/6
using GMT
line = [146.54294815408372 -36.04985956921628; 146.5457684472937 -36.04924988190973; 146.54706548053542 -36.04879871026288; 146.54919201177802 -36.047176909745176; 146.55074543531066 -36.04585993436855]
pt2 = mapproject([146.54376257030356 -36.04616479173944], dist2line=line)
I encountered the same error as in https://github.com/GenericMappingTools/GMT.jl/issues/59 and https://discourse.julialang.org/t/gmt-error-message-failure-to-open-virtual-file/116843
However, after applying all provided solutions, the error persisted. The code that causes the error is following:
It basically loops over a huge amount of points and computes a distance to a tram track. After running the loop for 100k times, the error is raised.
I am using GMT.jl v1.20.0 from master branch, and I have following version
but after first calling the
mapproject
function, I got warning about GMT versionGMT [WARNING]: GMT_COMPATIBILITY: Expects values from 6 to 6; reset to 6.
Here are all version of packages I am using: