Skip to content

Commit b73a964

Browse files
committed
Doc: specify what happens for Z/M for AddPoint() / AddPoint_2D()
Fixes OSGeo#11818
1 parent b2068ed commit b73a964

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

ogr/ogr_api.cpp

+21
Original file line numberDiff line numberDiff line change
@@ -872,6 +872,9 @@ void CPL_DLL OGR_G_SetPointsZM(OGRGeometryH hGeom, int nPointsIn,
872872
* points in the linestring, the point count will be increased to
873873
* accommodate the request.
874874
*
875+
* The geometry is promoted to include a Z component, if it does not already
876+
* have one.
877+
*
875878
* @param hGeom handle to the geometry to add a vertex to.
876879
* @param i the index of the vertex to assign (zero based) or
877880
* zero for a point.
@@ -993,6 +996,9 @@ void OGR_G_SetPoint_2D(OGRGeometryH hGeom, int i, double dfX, double dfY)
993996
* points in the linestring, the point count will be increased to
994997
* accommodate the request.
995998
*
999+
* The geometry is promoted to include a M component, if it does not already
1000+
* have one.
1001+
*
9961002
* @param hGeom handle to the geometry to add a vertex to.
9971003
* @param i the index of the vertex to assign (zero based) or
9981004
* zero for a point.
@@ -1055,6 +1061,9 @@ void OGR_G_SetPointM(OGRGeometryH hGeom, int i, double dfX, double dfY,
10551061
* points in the linestring, the point count will be increased to
10561062
* accommodate the request.
10571063
*
1064+
* The geometry is promoted to include a Z and M component, if it does not
1065+
* already have them.
1066+
*
10581067
* @param hGeom handle to the geometry to add a vertex to.
10591068
* @param i the index of the vertex to assign (zero based) or
10601069
* zero for a point.
@@ -1118,6 +1127,9 @@ void OGR_G_SetPointZM(OGRGeometryH hGeom, int i, double dfX, double dfY,
11181127
* The vertex count of the line string is increased by one, and assigned from
11191128
* the passed location value.
11201129
*
1130+
* The geometry is promoted to include a Z component, if it does not already
1131+
* have one.
1132+
*
11211133
* @param hGeom handle to the geometry to add a point to.
11221134
* @param dfX x coordinate of point to add.
11231135
* @param dfY y coordinate of point to add.
@@ -1161,6 +1173,9 @@ void OGR_G_AddPoint(OGRGeometryH hGeom, double dfX, double dfY, double dfZ)
11611173
* The vertex count of the line string is increased by one, and assigned from
11621174
* the passed location value.
11631175
*
1176+
* If the geometry includes a Z or M component, the value for those components
1177+
* for the added point will be 0.
1178+
*
11641179
* @param hGeom handle to the geometry to add a point to.
11651180
* @param dfX x coordinate of point to add.
11661181
* @param dfY y coordinate of point to add.
@@ -1202,6 +1217,9 @@ void OGR_G_AddPoint_2D(OGRGeometryH hGeom, double dfX, double dfY)
12021217
* The vertex count of the line string is increased by one, and assigned from
12031218
* the passed location value.
12041219
*
1220+
* The geometry is promoted to include a M component, if it does not already
1221+
* have one.
1222+
*
12051223
* @param hGeom handle to the geometry to add a point to.
12061224
* @param dfX x coordinate of point to add.
12071225
* @param dfY y coordinate of point to add.
@@ -1245,6 +1263,9 @@ void OGR_G_AddPointM(OGRGeometryH hGeom, double dfX, double dfY, double dfM)
12451263
* The vertex count of the line string is increased by one, and assigned from
12461264
* the passed location value.
12471265
*
1266+
* The geometry is promoted to include a Z and M component, if it does not
1267+
* already have them.
1268+
*
12481269
* @param hGeom handle to the geometry to add a point to.
12491270
* @param dfX x coordinate of point to add.
12501271
* @param dfY y coordinate of point to add.

swig/include/python/docs/ogr_geometry_docs.i

+42
Original file line numberDiff line numberDiff line change
@@ -894,4 +894,46 @@ For more details: :cpp:func:`OGR_G_SwapXY`
894894
895895
";
896896

897+
898+
%feature("docstring") AddPoint "
899+
Add a point to a geometry (line string or point).
900+
901+
The vertex count of the line string is increased by one, and assigned from
902+
the passed location value.
903+
904+
The geometry is promoted to include a Z component, if it does not already
905+
have one, even if the Z parameter is not explicitly specified. To avoid that
906+
use AddPoint_2D.
907+
908+
This is the same as :cpp:func:`OGR_G_AddPoint`
909+
910+
Parameters
911+
-----------
912+
X: float
913+
x coordinate of point to add.
914+
Y: float
915+
y coordinate of point to add.
916+
Z: float
917+
z coordinate of point to add. Defaults to 0
918+
";
919+
920+
%feature("docstring") AddPoint_2D "
921+
Add a point to a geometry (line string or point).
922+
923+
The vertex count of the line string is increased by one, and assigned from
924+
the passed location value.
925+
926+
If the geometry includes a Z or M component, the value for those components
927+
for the added point will be 0.
928+
929+
This is the same as :cpp:func:`OGR_G_AddPoint_2D`
930+
931+
Parameters
932+
-----------
933+
X: float
934+
x coordinate of point to add.
935+
Y: float
936+
y coordinate of point to add.
937+
";
938+
897939
}

0 commit comments

Comments
 (0)