Changes between Initial Version and Version 1 of rfc61_support_for_measured_geometries


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

Restart page from rfc61

Legend:

Unmodified
Added
Removed
Modified
  • rfc61_support_for_measured_geometries

    v1 v1  
     1= RFC 61 : Support for measured geometries =
     2
     3Author: Ari Jolma[[BR]]
     4
     5Contact: ari.jolma at gmail.com[[BR]]
     6
     7Status: Draft[[BR]]
     8
     9Implementation version: 2.1 or 2.2
     10
     11== Summary ==
     12
     13This 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
     17M coordinate is in the OGC simple feature model and it is used in many vector data formats.
     18
     19== Changes ==
     20
     21Changes 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
     25ogr_core.h:
     26{{{
     27#define OGR_G_NOT_EMPTY 1
     28#define OGR_G_3D 3
     29#define OGR_G_MEASURED 5
     30}}}
     31
     32New OGRwkbGeometryType values are needed - that is rather complex system now due to history.
     33
     34=== C++ API ===
     35
     36Change 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
     38Keep, but deprecate
     39{{{
     40getCoordinateDimension();
     41setCoordinateDimension();
     42}}}
     43
     44class OGRGeometry:
     45{{{
     46//Add methods:
     47int CoordinateDimension();
     48OGRBoolean Is3D();
     49OGRBoolean IsMeasured();
     50virtual void set3D(OGRBoolean bIs3D);
     51virtual void setMeasured(OGRBoolean bIsMeasured);
     52
     53//Add now or later methods:
     54virtual OGRGeometry *LocateAlong(double mValue);
     55virtual OGRGeometry *LocateBetween(double mStart, double mEnd);
     56}}}
     57
     58Add property double m to class OGRPoint. Add constructor, getters, and setters for it.
     59
     60Add 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
     62Override methods set3D and setMeasured in those classes where setCoordinateDimension is overridden.
     63
     64=== C API ===
     65
     66ogr_core.h:
     67{{{
     68OGRwkbGeometryType CPL_DLL OGR_GT_SetM( OGRwkbGeometryType eType );
     69int                CPL_DLL OGR_GT_HasM( OGRwkbGeometryType eType );
     70}}}
     71ogr_api.h: (new versions of some functions are needed, use postfix M)
     72{{{
     73void   CPL_DLL OGR_G_Is3D( OGRGeometryH );
     74void   CPL_DLL OGR_G_IsMeasured( OGRGeometryH );
     75
     76void   CPL_DLL OGR_G_Set3D( OGRGeometryH, int );
     77void   CPL_DLL OGR_G_SetMeasured( OGRGeometryH, int );
     78
     79int    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);
     84double CPL_DLL OGR_G_GetM( OGRGeometryH, int );
     85void   CPL_DLL OGR_G_GetPointM( OGRGeometryH, int iPoint,
     86                                double *, double *, double *, double * );
     87void   CPL_DLL OGR_G_SetPointM( OGRGeometryH, int iPoint,
     88                                double, double, double, double );
     89void   CPL_DLL OGR_G_AddPointM( OGRGeometryH, double, double, double, double );
     90void   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
     98ogr_p.g
     99{{{
     100const char CPL_DLL * OGRWktReadPointsM( const char * pszInput,
     101                                       OGRRawPoint **ppaoPoints,
     102                                       double **ppadfZ,
     103                                        double **ppadfM,
     104                                       int * pnMaxPoints,
     105                                       int * pnReadPoints );
     106void CPL_DLL OGRMakeWktCoordinateM( char *, double, double, double, double, int );
     107
     108}}}
     109
     110pggeometry.h is internal, so we can change the function prototype
     111{{{
     112void 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
     125The 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
     129Drivers 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
     134to do
     135
     136== Documentation ==
     137
     138All new methods/functions are documented.
     139
     140== Test Suite ==
     141
     142to do
     143
     144== Compatibility Issues ==
     145
     146to do
     147
     148== Related tickets ==
     149
     150https://trac.osgeo.org/gdal/ticket/6063
     151https://trac.osgeo.org/gdal/ticket/6331
     152
     153== Implementation ==
     154
     155The implementation will be done by Ari Jolma.
     156
     157The proposed implementation will be in https://github.com/ajolma/GDAL-XYZM
     158
     159== Voting history