-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ERROR: GMT: Failure to open virtual file #1558
Comments
Hi,
That said, your approach will be extremely slow. Calling Also, you don't need all that complication introduced by reading the data with GeoIO, GeoTables, etc. But still furthermore. If you want to isolate the points that are at a certain distance to the railway, use the |
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) |
When I tried julia> using GMT
julia> elev_map = gmtread("./map_data/elevation_map/zabaged_laz/zabaged_laz.geojson")
Vector{GMTdataset} with 3081064 segments
Showing first segment. To see other segments just type its element number. e.g. D[2]
Attribute table
┌─────────┬────────┬────────────┐
│ Row │ alt │ Feature_ID │
├─────────┼────────┼────────────┤
│ 1 │ 274.03 │ 1 │
│ 2 │ 274.01 │ 2 │
│ 3 │ 273.27 │ 3 │
│ 4 │ 273.15 │ 4 │
│ 5 │ 273.03 │ 5 │
│ ⋮ │ ⋮ │ ⋮ │
│ 3081060 │ 226.75 │ 3081060 │
│ 3081061 │ 227.47 │ 3081061 │
│ 3081062 │ 226.39 │ 3081062 │
│ 3081063 │ 227.29 │ 3081063 │
│ 3081064 │ 227.29 │ 3081064 │
└─────────┴────────┴────────────┘
3081054 rows omitted
BoundingBox: [18.14125131335861, 18.14125131335861, 49.80814636486823, 49.80814636486823]
Global BoundingBox: [18.14125131335861, 18.254640543109993, 49.76887306370226, 49.843758859141765, 0.0, 0.0]
PROJ: +proj=longlat +datum=WGS84 +no_defs
WKT: GEOGCS["WGS 84",
DATUM["WGS_1984",
SPHEROID["WGS 84",6378137,298.257223563]],
PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433]]
1×2 GMTdataset{Float64, 2}
Row │ Lon Lat
─────┼──────────────────
1 │ 18.1413 49.8081
julia> rail = gmtread("./map_data/railway_map/railway_tram7.geojson")
Vector{GMTdataset} with 281 segments
Showing first segment. To see other segments just type its element number. e.g. D[2]
Attribute table
┌─────┬────────┬──────────────┬──────────────────┬────────┬─────────┬─────────────────────────────────┬───────────────────┬──────────────────────────────────────┬──────────────┬─────│ Row │ oneway │ crossing_ref │ public_transport │ bridge │ covered │ network:wikipedia │ operator:wikidata │ name │ electrified │ op ⋯├─────┼────────┼──────────────┼──────────────────┼────────┼─────────┼─────────────────────────────────┼───────────────────┼──────────────────────────────────────┼──────────────┼─────│ 1 │ │ │ │ │ │ cs:Tramvajová doprava v Ostravě │ Q11323689 │ Tram 7 Poruba, Vřesinská - Výškovice │ │ cs ⋯│ 2 │ │ │ │ │ │ cs:Tramvajová doprava v Ostravě │ Q11323689 │ Tram 7 Poruba, Vřesinská - Výškovice │ │ cs ⋯│ 3 │ │ │ │ │ │ cs:Tramvajová doprava v Ostravě │ Q11323689 │ Tram 7 Výškovice - Poruba, Vřesinská │ │ cs ⋯│ 4 │ │ │ │ │ │ cs:Tramvajová doprava v Ostravě │ Q11323689 │ Tram 7 Výškovice - Poruba, Vřesinská │ │ cs ⋯│ 5 │ │ │ platform │ │ │ │ │ │ │ ⋯│ ⋮ │ ⋮ │ ⋮ │ ⋮ │ ⋮ │ ⋮ │ ⋮ │ ⋮ │ ⋮ │ ⋮ │ ⋱│ 277 │ │ │ │ │ │ │ │ │ │ ⋯│ 278 │ │ │ │ │ │ │ │ │ │ ⋯│ 279 │ │ │ │ │ │ │ │ │ │ ⋯│ 280 │ │ │ │ │ │ │ │ │ │ ⋯│ 281 │ │ │ │ │ │ │ │ │ │ ⋯└─────┴────────┴──────────────┴──────────────────┴────────┴─────────┴─────────────────────────────────┴───────────────────┴──────────────────────────────────────┴──────────────┴───── 31 columns and 271 rows omittedBoundingBox: [18.158548, 18.24835, 49.7725848, 49.8348159]
Global BoundingBox: [18.1582647, 18.248401, 49.7725848, 49.834852, 0.0, 0.0]
PROJ: +proj=longlat +datum=WGS84 +no_defs
WKT: GEOGCS["WGS 84",
DATUM["WGS_1984",
SPHEROID["WGS 84",6378137,298.257223563]],
PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433]]
452×2 GMTdataset{Float64, 2}
Row │ Lon Lat
─────┼──────────────────
1 │ 18.1585 49.8222
2 │ 18.1586 49.8222
3 │ 18.1587 49.8222
4 │ 18.1588 49.8222
5 │ 18.1589 49.8222
6 │ 18.159 49.8222
⋮ │ ⋮ ⋮
448 │ 18.2248 49.7727
449 │ 18.2248 49.7727
450 │ 18.2249 49.7727
451 │ 18.2249 49.7727
452 │ 18.2249 49.7728
441 rows omitted
julia> buffer(rail, 150)
ERROR 1: IllegalArgumentException: point array must contain 0 or >1 elements
ERROR 10: Pointer 'hGeom' is NULL in 'OGR_G_GetGeometryType'.
ERROR 1: IllegalArgumentException: point array must contain 0 or >1 elements
ERROR 10: Pointer 'hGeom' is NULL in 'OGR_G_GetGeometryType'.
ERROR 10: Pointer 'hGeom' is NULL in 'OGR_G_GetGeometryType'.
ERROR 10: Pointer 'hGeom' is NULL in 'OGR_G_GetCoordinateDimension'.
ERROR 10: Pointer 'hGeom' is NULL in 'OGR_G_GetPointCount'.
ERROR 10: Pointer 'hGeom' is NULL in 'OGR_G_GetGeometryCount'.
String[]
Is there something I'm missing? |
Wow, that's a lot of segments, and each with only 1 point. It would be much better if you had a single segments with 308104 points (a multi-point geometry). I deduce from the file name, The problem in
And still about the previous error with |
I provided the MWE here: #1558 (comment). At the first call, this warning occurs |
Sorry, I got an email notification for your second post, not the one referring the MWE. If it crashes only after a long number of calls, that makes it much more difficult to catch. I would need the full example to try to reproduce it (the Note that you can do a lot of processing with GMT alone, namely grid interpolations. I would be curious to know about typical things that you can do with Geostats that can't be done with GMT. And, BTW, GMT.jl has |
The julia> buffergeo(rail, width=150)
GMT [WARNING]: GMT_COMPATIBILITY: Expects values from 6 to 6; reset to 6.
ERROR: BoundsError: attempt to access 0×0 Matrix{Float64} at index [1:0, 3]
Stacktrace:
[1] throw_boundserror(A::Matrix{Float64}, I::Tuple{Base.Slice{Base.OneTo{Int64}}, Int64})
@ Base .\abstractarray.jl:737
[2] checkbounds
@ .\abstractarray.jl:702 [inlined]
[3] view(::Matrix{Float64}, ::Function, ::Int64)
@ Base .\subarray.jl:184
[4] buffergeo(line::Matrix{…}; width::Int64, unit::Symbol, np::Int64, flatstart::Bool, flatend::Bool, proj::String, epsg::Int64, tol::Float64)
@ GMT C:\Users\oslejsek\.julia\packages\GMT\yRgLc\src\proj_utils.jl:352
[5] buffergeo(D::Vector{…}; width::Int64, unit::Symbol, np::Int64, flatstart::Bool, flatend::Bool, epsg::Int64, tol::Float64)
@ GMT C:\Users\oslejsek\.julia\packages\GMT\yRgLc\src\proj_utils.jl:312
[6] top-level scope
@ REPL[5]:1
Some type information was truncated. Use `show(err)` to see complete types. Regarding the |
Well, from the error message it is saying that the rail variable is empty.
|
Can you make that |
Actually that example is taken from https://discourse.julialang.org/t/how-to-calculate-the-nearest-point-on-a-line-to-a-given-point/105743/6. The |
But can't you zip it and attached it here? |
There is the |
Thanks. I can now reproduce the error. And when I try with the cartesian version I get further info
So it looks like one, or more, of the 281 segments are empty. I'll try to make the reading and/or buffering functions more resistant to faulty data. But meanwhile this works fine.
|
OK, the problem is that the file has two lines, one for each rail, plus a lot of other single point segments and it were these single point segments that resulted caused the error in |
Can we close this? |
I encountered the same error as in #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:
The text was updated successfully, but these errors were encountered: