gmtspatial -Q need modifier to force line or polygon
|Target version:||Candidate for next minor release|
If the user has unclosed polygons (i.e., missing repeating point) then -Q will assume input is a line and compute length and mid-point, not area and centroid. I suggest we add a modifier +p or +l to the -Q option to force the input to either be automatically closed to a polygon (+p) or to be consider a line despite being possibly closed (+l).
#3 Updated by Paul over 6 years ago
I wonder if that is more of a thing for gmtconvert? In general, GMT does not care if things are closed or not (e.g., psxy, grdmask, etc), but in gmtspatial -Q we made a decision to compute line lengths vs polygon area based on lines being closed/open. In that case a modifier is needed to override that automatic decision.
I suppose you want closed polygons for something outside of GMT? Otherwise I don't think it is necessary to explicitly do this.
GMT_Read_Data can be give a geometry (polygon) and then it automatically closes polygons when reading. So gmtconvert could take a new -F option or something and then on output those polygons would be closed. Or if you think this is really a needed geospatial operation then we could do it in gmtspatial I guess.
#4 Updated by Florian over 6 years ago
I wonder if that is more of a thing for gmtconvert?
Might as well. I don't mind.
I suppose you want closed polygons for something outside of GMT?
Right, I often convert to ESRI Shapefile or other formats and then I really have to make sure every Polygon is closed. Having this feature would make the process much easier.
So gmtconvert could take a new -F option or something and then on output those polygons would be closed.
Thanks, that would be great!