Changes between Version 5 and Version 6 of rfc61


Ignore:
Timestamp:
Jan 27, 2016, 12:29:39 PM (8 years ago)
Author:
Ari Jolma
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • rfc61

    v5 v6  
    1 = RFC 61 : Support for measured geometries =
    2 
    3 Author: Ari Jolma[[BR]]
    4 
    5 Contact: ari.jolma at gmail.com[[BR]]
    6 
    7 Status: Draft[[BR]]
    8 
    9 Implementation version: 2.1 or 2.2
    10 
    11 == Summary ==
    12 
    13 This RFC defines how to implement measured geometries (geometries, where the points have M coordinate, i.e., they are XYM or XYZM).
    14 
    15 == Rationale ==
    16 
    17 M coordinate is in the OGC simple feature model and it is used in many vector data formats.
    18 
    19 == Changes ==
    20 
    21 Changes are required into the C++ API and the C API needs to be enhanced. Several drivers need to be changed to take advantage of this enhancement but also due to the changes in the C++ API.
    22 
    23 === Common API ===
    24 
    25 ogr_core.h:
    26 {{{
    27 #define OGR_G_NOT_EMPTY 1
    28 #define OGR_G_3D 3
    29 #define OGR_G_MEASURED 5
    30 }}}
    31 
    32 New OGRwkbGeometryType values are needed - that is rather complex system now due to history.
    33 
    34 === C++ API ===
    35 
    36 Change int nCoordDimension to int flags, which is used to keep track of whether the geometry is empty (currently hacks such as nCoordDimension == -2 is used for that), has Z, or is measured. IsEmpty = flags & ~OGR_G_NOT_EMPTY, Is3D = flags & OGR_G_3D, IsMeasured = flags & OGR_G_MEASURED.
    37 
    38 Keep, but deprecate
    39 {{{
    40 getCoordinateDimension();
    41 setCoordinateDimension();
    42 }}}
    43 
    44 class OGRGeometry:
    45 {{{
    46 //Add methods:
    47 int CoordinateDimension();
    48 OGRBoolean Is3D();
    49 OGRBoolean IsMeasured();
    50 virtual void set3D(OGRBoolean bIs3D);
    51 virtual void setMeasured(OGRBoolean bIsMeasured);
    52 
    53 //Add now or later methods:
    54 virtual OGRGeometry *LocateAlong(double mValue);
    55 virtual OGRGeometry *LocateBetween(double mStart, double mEnd);
    56 }}}
    57 
    58 Add property double m to class OGRPoint. Add constructor, getters, and setters for it.
    59 
    60 Add property double *padfM to class OGRSimpleCurce. Add constructor, getters, and setters for it. The getters and setters can take advantage of the flags to determine whether Z or M is to be set in some of them. For backwards compatibility Z is preferred.
    61 
    62 Override methods set3D and setMeasured in those classes where setCoordinateDimension is overridden.
    63 
    64 === C API ===
    65 
    66 ogr_core.h:
    67 {{{
    68 OGRwkbGeometryType CPL_DLL OGR_GT_SetM( OGRwkbGeometryType eType );
    69 int                CPL_DLL OGR_GT_HasM( OGRwkbGeometryType eType );
    70 }}}
    71 ogr_api.h: (new versions of some functions are needed, use postfix M)
    72 {{{
    73 void   CPL_DLL OGR_G_Is3D( OGRGeometryH );
    74 void   CPL_DLL OGR_G_IsMeasured( OGRGeometryH );
    75 
    76 void   CPL_DLL OGR_G_Set3D( OGRGeometryH, int );
    77 void   CPL_DLL OGR_G_SetMeasured( OGRGeometryH, int );
    78 
    79 int    CPL_DLL OGR_G_GetPointsM( OGRGeometryH hGeom,
    80                                  void* pabyX, int nXStride,
    81                                  void* pabyY, int nYStride,
    82                                  void* pabyZ, int nZStride,
    83                                  void* pabyM, int nMStride);
    84 double CPL_DLL OGR_G_GetM( OGRGeometryH, int );
    85 void   CPL_DLL OGR_G_GetPointM( OGRGeometryH, int iPoint,
    86                                 double *, double *, double *, double * );
    87 void   CPL_DLL OGR_G_SetPointM( OGRGeometryH, int iPoint,
    88                                 double, double, double, double );
    89 void   CPL_DLL OGR_G_AddPointM( OGRGeometryH, double, double, double, double );
    90 void   CPL_DLL OGR_G_SetPointsM( OGRGeometryH hGeom, int nPointsIn,
    91                                  void* pabyX, int nXStride,
    92                                  void* pabyY, int nYStride,
    93                                  void* pabyZ, int nZStride,
    94                                  void* pabyM, int nMStride );
    95 
    96 }}}
    97 
    98 ogr_p.g
    99 {{{
    100 const char CPL_DLL * OGRWktReadPointsM( const char * pszInput,
    101                                        OGRRawPoint **ppaoPoints,
    102                                        double **ppadfZ,
    103                                         double **ppadfM,
    104                                        int * pnMaxPoints,
    105                                        int * pnReadPoints );
    106 void CPL_DLL OGRMakeWktCoordinateM( char *, double, double, double, double, int );
    107 
    108 }}}
    109 
    110 pggeometry.h is internal, so we can change the function prototype
    111 {{{
    112 void OGRCreateFromMultiPatchPart(OGRMultiPolygon *poMP,
    113                                  OGRPolygon*& poLastPoly,
    114                                  int nPartType,
    115                                  int nPartPoints,
    116                                  double* padfX,
    117                                  double* padfY,
    118                                  double* padfZ,
    119                                  double* padfM);
    120 }}}
    121 
    122 
    123 == SWIG bindings (Python / Java / C# / Perl) changes ==
    124 
    125 The new C API functions need to be exposed through swig. Further changes depend on whether the language bindings are aware of coordinates. At least Python and Perl are.
    126 
    127 == Drivers ==
    128 
    129 Drivers that are probably affected by the C++ changes are at least (these use the CoordinateDimension API) pg, mssqlspatial, sqlite, db2, mysql, gml, pgdump, geojson, libkml, gpkg, wasp, gpx, filegdb, vfk, bna, dxf.
    130 
    131 
    132 == Utilities ==
    133 
    134 to do
    135 
    136 == Documentation ==
    137 
    138 All new methods/functions are documented.
    139 
    140 == Test Suite ==
    141 
    142 to do
    143 
    144 == Compatibility Issues ==
    145 
    146 to do
    147 
    148 == Related tickets ==
    149 
    150 https://trac.osgeo.org/gdal/ticket/6063
    151 https://trac.osgeo.org/gdal/ticket/6331
    152 
    153 == Implementation ==
    154 
    155 The implementation will be done by Ari Jolma.
    156 
    157 The proposed implementation will be in https://github.com/ajolma/GDAL-XYZM
    158 
    159 == Voting history
    160 
     1[wiki:rfc61_support_for_measured_geometries RFC 61: Support for measured geometries]