Skip to content

Improve/fix the gmt_ogrread function and include in the lib code. - #445

Merged
joa-quim merged 4 commits into
masterfrom
newogrread
Feb 27, 2019
Merged

joa-quim merged 4 commits into
masterfrom
newogrread

Conversation

@joa-quim

Copy link
Copy Markdown
Member

Start the work of reading the OGR vector formats directly via GDAL. The gmt_ogrreaf() 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_ogrreaf() 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)

gmtjl_tmp

@joa-quim
joa-quim requested a review from PaulWessel February 27, 2019 00:31
@PaulWessel

Copy link
Copy Markdown
Contributor

Looks like there are compiling errors in Travis for Linux - could you check and see what is missing (if anything)?

@joa-quim

Copy link
Copy Markdown
Member Author

Don't get it. It looks like it's not finding some GDAL pieces (can't be the whole GDAL because it doesn't complain with gdalread). It builds fine on OSX though.

@PaulWessel

Copy link
Copy Markdown
Contributor

Maybe @leouieda can sniff out what is happening?

@joa-quim

Copy link
Copy Markdown
Member Author

I bet it's our friend Ubuntu being stable. We need at least GDAL2.0 but it likely is still at 1.11 (a couple of years old)

@PaulWessel

Copy link
Copy Markdown
Contributor

Wonder if possible to isolate under a "#if GDAL_VERSION > 2" test?

@joa-quim

Copy link
Copy Markdown
Member Author

Yes. It would be #if (GDAL_VERSION_NUM >= 2000) but I would like to confirm that this is the source of the errors. My Winbuntu, where the same error occurs, refused to update GDAL beyond 1.11 (from 2015). What a beautiful world. I'm now upgrading the entire WSL OS but it promised to take the whole night to do that.

@leouieda

Copy link
Copy Markdown
Member

I bet it's our friend Ubuntu being stable

Travis uses Ubuntu Xenial and the latest gdal there is 1.11.3. But I don't think there is a good way around this other than getting gdal from another source. This is why I use the conda packages for pygmt but that comes with its own set of headaches.

If it breaks on Travis, you can bet it will break for all our Ubuntu users who follow our install instructions and don't build GDAL from source.

@joa-quim

Copy link
Copy Markdown
Member Author

OK, it turned out that upgrading Winbuntu was quicker then "the whole night" and I now have a

j@MacMarilu:~/programs/build$ gdalinfo --version
GDAL 2.2.3, released 2017/11/20

With this it builds fine. So I don't understand why Travis is still failing since I added the #if (GDAL_VERSION_NUM >= 2000) in 160cb76

@joa-quim

Copy link
Copy Markdown
Member Author

Replaced the versioning condition by #if GDAL_VERSION_MAJOR >= 2 it now passes also in Linux.

@PaulWessel PaulWessel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good one.

@joa-quim
joa-quim merged commit 540505b into master Feb 27, 2019
@remkos
remkos deleted the newogrread branch March 9, 2019 21:21
obaney pushed a commit to obaney/gmt that referenced this pull request Aug 18, 2021
Changelog for a bugfix release that finally supports Windows! Release date set to 2020/05/22.

Co-authored-by: Dongdong Tian <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants