Skip to content

Geometries in GMT #3013

Closed
Closed

Description

@joa-quim

This issue is an ensemble of scattered thoughts on this matter and result from my attempts to read OGR files directly (i.e. without under the hood conversion to text temporary files) and to be able to use the numerous methods offered by the GEOS lib.

#453
#2961
and a bit more loosely related the gdal_librarified work

I think time has come for us to get closer the so called GIS world. From my limited knowledge of it, geometries are fundamental block. See the postgis page for a basic description of the geometries used in the GIS world (GEOS (the base, I think), postgis, GDAL).

We already have

enum GMT_enum_ogr {
	GMT_IS_LINESTRING	= 2U,
	GMT_IS_POLYGON		= 4U,
	GMT_IS_MULTI		= 64U,	/* Flag for multi-versions of geometry */
	GMT_IS_MULTIPOINT	= 65U,	/* 1 plus 64 for multi */
	GMT_IS_MULTILINESTRING	= 66U,	/* 2 plus 64 for multi */
	GMT_IS_MULTIPOLYGON	= 68U};	/* 4 plus 64 for multi */

but GMT_DATASET use

/* GIS geometries, with GMT_IS_NONE as 16 for no such thing */
enum GMT_enum_geometry {
	GMT_IS_POINT	= 1U,
	GMT_IS_LINE	= 2U,
	GMT_IS_POLY	= 4U,
	GMT_IS_LP	= 6U,	/* Could be any one of LINE or POLY */
	GMT_IS_PLP	= 7U,	/* Could be any one of POINT, LINE, POLY */
	GMT_IS_SURFACE	= 8U,
	GMT_IS_NONE	= 16U,	/* Non-geographical items like color palettes */
	GMT_IS_TEXT	= 32U	/* Text strings which triggers ascii text reading */
};

not sure how those two overlap. And also not sure if a dataset can have segments of different geometry types.

We have also the very handy multi-segments files, but we don't have a way to assign a geometry via the segment headers. I think we need that. But even this is of more restricted usage because segment headers exist only in the ASCII version and not in its the binary form. Text files in these days of huge data files severely limit their usage. That is why I don't consider the ogr gmt files a viable future.

Questions:

  • Should we add an optional -G*<geom_ID>* to ascii muti-segment files?
  • Do we need to expand the GMT_DATASET to accommodate a full description of which geometry is a datasegment?
  • Would the above change (if, that's the case) create a compatibility break?

Activity

  1. PaulWessel commented on Apr 2, 2020

    @PaulWessel
    Contributor

    I think the two conflicting sets of enums need to be consolidated. Clearly, the ogr ones were added later and piecemeal. Also, I think no GIS format supports variable geometry within one file, so I think we should keep geometry at the file-level and not segment level. We have -a that can set the geometry but probably only used in gmtconvert to make an ogr file.

  2. joa-quim commented on Apr 2, 2020

    @joa-quim
    MemberAuthor

    think no GIS format supports variable geometry within one file

    Yes there are. Probably only the dumb shape files doesn't. GDAL model does and see the GEOMETRYCOLLECTION in postgis file I linked.

    And I think the gmt_ogrread() also accounts for multiple geometries, but then doesn't know what to do with them.

  3. PaulWessel commented on Apr 2, 2020

    @PaulWessel
    Contributor

    OK, thanks, seeing that now. Agenda topic I think.

  4. joa-quim commented on Apr 2, 2020

    @joa-quim
    MemberAuthor

    Yep, also had the agenda in mind when decided to open this topic to discussion.

  5. added
    discussion
    feature request
    on Apr 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionfeature request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions