You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recover the bit bellow from #445. This work rises questions that we need to discuss. For example right now I would like to know what's better way to transfer the data points into the nested GMT structs. As is or in a *xyz single array?
Start the work of reading the OGR vector formats directly via GDAL. The gmt_ogrread() uses a design inherited from it's Matlab ancestor in Mirone and hence it's structure must be improved to fit better with the GMT needs. But as it is we can already load data directly. We still need to write code to parse its contents and feed the corresponding GMT data structures, so as it is we can't use it yet but as a proof o concept I added one such type of function parser in Julia that converts the gmt_ogrread() output into a GMTdataset. It works like this.
# Create an API session
API = GMT.GMT_Create_Session("GMT", 2, GMT.GMT_SESSION_NOEXIT + GMT.GMT_SESSION_EXTERNAL + GMT.GMT_SESSION_COLMAJOR);
# Read a shape file directly from ... wherever it is
ex = GMT.gmt_ogrread(API, "/vsicurl/https://raw.githubusercontent.com/OSGeo/gdal/master/autotest/ogr/data/poly.shp");
# Plot it
plot(GMT.ogr2GMTdataset(ex), show=1, fmt=:png)
The trouble (for me) with it is that with time the branch will start to diverge more and more from master and become boring to always change branch/rebuild to allow me to use it from Julia. As is, it only includes two extra functions in master that are not yet used.
Perhaps, but it takes 1-2 clicks to merge any change to master into the branch. I do that all the time with the nicerectclip branch until it is ready. At some point you will need to make changes that cannot be under #if - #endif or the code with all those statements gets unreadable.
I kind of agree with @PaulWessel that it's better not to merge things that are still not "done", documented, or covered by tests. This kind of thing has a way of biting us in the ass later on.
only protects for breaking the build on the Ubuntus of this life
As I said in the beginning, I'm doing this on GMT and Julia at same time. Sure it can be done from a branch, but if the level of cumbersomeness raises above the threshold ...
BTW, what about my question in first paragraph of first post?
But that's exactly the work that remains to be done. If I had that already, then the work would be finished. One of the issues is that the OGR features model has a lot more that we can encode in GMT_DATASET. I just checked (perhaps too quickly) that if we read a .gmt file, the aspatial info does not show up in the GMT_DATASET. At least when it lands in Julia (ML would be the same).
GMT_DATASET has no provision for attribute names for example. That's why I'm looking at -L -I or -T in header lines for alternatives to storing them. #213 seems related to this.
Unless we change the entore GMT/OGR machinery (which we probably cannot) I think you have to see what happens when OGR data is read and what structures are filled to hold the attributes names and types. This is in a GMT_OGR structure in the GMT main struct and then data are stored in similar struct per segment I think. These are filled in by the two ogr parsers in gmt_io.c
This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions.
Activity
PaulWessel commentedon Mar 1, 2019
Since this is clearly work in progress, would not a WIP branch be much better than adding #if etc in master?
joa-quim commentedon Mar 1, 2019
The trouble (for me) with it is that with time the branch will start to diverge more and more from master and become boring to always change branch/rebuild to allow me to use it from Julia. As is, it only includes two extra functions in master that are not yet used.
PaulWessel commentedon Mar 1, 2019
Perhaps, but it takes 1-2 clicks to merge any change to master into the branch. I do that all the time with the nicerectclip branch until it is ready. At some point you will need to make changes that cannot be under #if - #endif or the code with all those statements gets unreadable.
joa-quim commentedon Mar 1, 2019
Ah, but the code is not #ifdefed the
#if GDAL_VERSION_MAJOR >= 2only protects for breaking the build on the Ubuntus of this life.leouieda commentedon Mar 1, 2019
I kind of agree with @PaulWessel that it's better not to merge things that are still not "done", documented, or covered by tests. This kind of thing has a way of biting us in the ass later on.
With Ubuntu it might be a very long life indeed 👴
joa-quim commentedon Mar 1, 2019
As I said in the beginning, I'm doing this on GMT and Julia at same time. Sure it can be done from a branch, but if the level of cumbersomeness raises above the threshold ...
BTW, what about my question in first paragraph of first post?
PaulWessel commentedon Mar 1, 2019
OK, in regards to first paragraph: Ideally, you would return a GMT_DATASET struct since you may need to assign trailing text from aspatial items.
joa-quim commentedon Mar 1, 2019
But that's exactly the work that remains to be done. If I had that already, then the work would be finished. One of the issues is that the OGR features model has a lot more that we can encode in GMT_DATASET. I just checked (perhaps too quickly) that if we read a .gmt file, the aspatial info does not show up in the GMT_DATASET. At least when it lands in Julia (ML would be the same).
PaulWessel commentedon Mar 1, 2019
I think stuff ends up in the OGR structures hooked to the DATASET.
joa-quim commentedon Mar 1, 2019
GMT_DATASET has no provision for attribute names for example. That's why I'm looking at -L -I or -T in header lines for alternatives to storing them. #213 seems related to this.
PaulWessel commentedon Mar 1, 2019
Unless we change the entore GMT/OGR machinery (which we probably cannot) I think you have to see what happens when OGR data is read and what structures are filled to hold the attributes names and types. This is in a GMT_OGR structure in the GMT main struct and then data are stored in similar struct per segment I think. These are filled in by the two ogr parsers in gmt_io.c
stale commentedon Mar 31, 2019
This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions.