gmtspatial -N usage

Added by John 4 months ago

I'm probably just not using gmtspatial properly. The aim is to determine which polygons a point fall inside of. I've created a test case, but am getting segmentation fault errors.

Essentially, I'm just sending a lon,lat point to gmtspatial and test.txt has two polygons (one of which should contain the point). Am I mis-reading what the -N option can do?

Here's my command, it's results, and I've attached the test.txt data set (consisting of two closed polygons).

> echo -147 64 | gmtspatial -Ntest.txt
ERROR: Caught signal number 11 (Segmentation fault) at
0   libgmt.6.dylib                      0x000000010561e058 gmtlib_read_table + 3336
1   ???                                 0x0000000000000000 0x0 + 0
Stack backtrace:
0   libgmt.6.dylib                      0x00000001055b6453 sig_handler + 579
1   libsystem_platform.dylib            0x00007fffe770bb3a _sigtramp + 26
2   ???                                 0x0000000000000001 0x0 + 1
3   libgmt.6.dylib                      0x00000001055d6906 api_import_data + 4022
4   libgmt.6.dylib                      0x00000001055c72ec api_get_data + 172
5   libgmt.6.dylib                      0x00000001055c13e7 GMT_Read_Data + 4503
6   libgmt.6.dylib                      0x0000000105772747 GMT_gmtspatial + 19895
7   libgmt.6.dylib                      0x00000001055cdae0 GMT_Call_Module + 272
8   gmtspatial                          0x00000001055aaf7e main + 1038
9   libdyld.dylib                       0x00007fffe74fc235 start + 1
10  ???                                 0x0000000000000002 0x0 + 2

Thanks for setting me straight!

test.txt Magnifier (1.42 KB)


Replies (8)

RE: gmtspatial -N usage - Added by Paul 4 months ago

Confirming the crash. Slight regression after major redo of how text is handled (of which there is not here). Will look later today.

RE: gmtspatial -N usage - Added by John 4 months ago

Thanks for confirming that I'm not crazy, and that I'm not hammering on GMT inappropriately! Thanks, Pau!!

This will be a useful tool for a special requirement I have.

RE: gmtspatial -N usage - Added by Paul 4 months ago

Should be fixed in r19757.

RE: gmtspatial -N usage - Added by John 4 months ago

This morning, to update, I ran svn (for GMT r19763) and got an error during the make install step. Attaching a screen shot. Something about "struct EULER" having a problem.

RE: gmtspatial -N usage - Added by Joaquim 4 months ago

Sorry, made some faulty fixes to coverity reports. Fixed now.

RE: gmtspatial -N usage - Added by John 4 months ago

Excellent! Thanks Joaquim. Successful installation!

RE: gmtspatial -N usage - Added by John 4 months ago

Okay, still learning the details about this command.

It seems that to get the count of which polygon a point (or segment) is in, you use the -Npfile+p option.

Apparently, gmtspatial is only able to report the count for the first polygon found.

There is a line in the man page that says, "If more than one polygon contains the same segment we skip the second (and further) scenario." [scenario?]

I'd like to request that another + option (to -N) be added that would allow for gmtspatial to report counts for ALL polygons that a point falls within. Perhaps a +e (for "every") could be used that would report every polygon a point or segment falls within?

My final aim, based on polygons dumped from Landsat WRS2 shape files, is to be able to feed a lon,lat to gmtspatial and have it tell me which path & row polygons the point falls into.

test.txt Magnifier (1.86 KB)

RE: gmtspatial -N usage - Added by John 4 months ago

Ignore test.txt in the previous post.

(1-8/8)