Bug #864

mapproject binary manipulations

Added by John over 5 years ago. Updated over 5 years ago.

Status:ClosedStart date:2016-02-25
Priority:NormalDue date:
Assignee:Paul% Done:


Target version:Candidate for next bugfix release
Affected version:5.x-svn Platform:Mac OS X


Seems there may be a problem when mapproject is directed to output binary in the presence of the -o specifier. This applies to Version 5.3.0_r15762

Example. Assume a simple 3-row, 4-column file (call it t.txt) with first two columns having some ancillary parameters, and the last two columns have lat and lon (not lon and lat):

1 2 10 15
2 2 12 11
3 4 16 9

Convert this to a binary file via:

gmtconvert t.txt -bo4d > t.bin

Say, we want to use mapproject to compute the distances (in km) from each point to (say) 0,0 (lon,lat), and have the output placed back in it's original order, with the newly computed distance appended as column 4. We use:

mapproject t.bin -G0/0k -bi4d -i3,2,0,1 -bo5d -o2,3,1,0,4 > td.bin

but it fails, with this message:

mapproject: Syntax error: Binary output data (-bo) provides 4 but column selection (-o) asks for 5 columns

I thought -bo5d was asking for 5 columns of output!

This example is trivial. I need to apply something similar for a file with millions of rows.


#1 Updated by Paul over 5 years ago

  • Status changed from New to In Progress
  • Assignee set to Paul
  • Target version set to Candidate for next bugfix release

I am having a look and will post when I have a solution.

#2 Updated by Paul over 5 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 0 to 100

Fixed in r15920 (trunk and 5.2.2 branch). Problem was that the -o parser decided to reset the number of output columns to match that of the input...

#3 Updated by John over 5 years ago

Thanks, Paul! Now I just have to remember what I was trying to do when I first reported this! Cheers!

#4 Updated by Paul over 5 years ago

  • Status changed from Resolved to Closed

I am closing this issue - feel free to reopen if you can reproduce a new problem.

Also available in: Atom PDF