Skip to content

Let GMT honor/check the geometries passed via GMT/OGR or shapefiles #5629

Open

Description

@PaulWessel

Description of the desired feature

See this PyGMT post for details.
Having thought about this some more, it seems reasonable that a dataset that has proper metadata that says the coordinates are points should not default to plotting lines. There is a differences between a plain text file with coordinates (which can mean points, lines or polygons) and a shapefile that says "I am a polygon".

Currently plot and plot3d do not care, but my proposal is that we do a check on geometry and

  1. Change the default from line to point if given points
  2. Give error if user tries to plot points as polygon or line explicitly.

This may affect a few more modules that read table data and expects points.

Activity

  1. added
    feature request
    on Aug 11, 2021
  2. self-assigned this
    on Aug 11, 2021
  3. seisman commented on Aug 11, 2021

    @seisman
    Member

    Currently plot and plot3d do not care, but my proposal is that we do a check on geometry and

    1. Change the default from line to point if given points
    2. Give error if user tries to plot points as polygon or line explicitly.

    For dataset that has a POINT geometry, if the default is points, how can users explicitly plot the data as lines or polygons?

  4. PaulWessel commented on Aug 11, 2021

    @PaulWessel
    ContributorAuthor

    If we want users to have the ability to override the dataset's geometry, then we would have to have a way for them to say so. Maybe something like -S/ could mean "line symbol" (i.e., no symbol, draw lines).

    Does other software allow points to be plotted as lines, e.g., if arcGIS or QGIS reads a points file, is it even possible to draw a polygon? I just wonder if the expectation here is to completely honor the geometry if one is given. If the user wants those points to be plotted as polygons then perhaps gmt convert points.ogr | gmt plot -Gred is the way to do it?

  5. seisman commented on Aug 11, 2021

    @seisman
    Member

    Does other software allow points to be plotted as lines, e.g., if arcGIS or QGIS reads a points file, is it even possible to draw a polygon?

    I have no idea about this. Ping @weiji14 and @yohaimagen for comments.

  6. weiji14 commented on Aug 11, 2021

    @weiji14
    Member

    Does other software allow points to be plotted as lines, e.g., if arcGIS or QGIS reads a points file, is it even possible to draw a polygon?

    I have no idea about this. Ping @weiji14 and @yohaimagen for comments.

    I think Points/MultiPoints are always plotted as points in most GIS software. One would usually need to convert a Point layer explicitly into a Line or Polygon type to plot them as such.

  7. joa-quim commented on Aug 12, 2021

    @joa-quim
    Member

    It normally should not make much sense to plot Points as lines, but it's not up to GMT to censor it. Datasets may have inherited the Points/multiPoints geometry from a lost ancestrality.
    ... and this goes far beyond shapefies. I've called before to the need that datasets all have a geometry, even if unknown.

  8. yohaimagen commented on Aug 12, 2021

    @yohaimagen

    Does other software allow points to be plotted as lines, e.g., if arcGIS or QGIS reads a points file, is it even possible to draw a polygon?

    In Qgis it automatically opens the file as the specified geometry, without the option to specify other geometry. if no geometry is specified it plotting points. I believe the same is for arcGIS.

  9. PaulWessel commented on Aug 12, 2021

    @PaulWessel
    ContributorAuthor

    That is what I would expect; otherwise what is the point of keeping geometry as an attribute. So the question then is should GMT start to enforce this behavior when the geometry is known (i.e., via the shapefile, OGR files)? Or is a warning for now adequate?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

feature request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions