Skip to content

Commit

Permalink
Merge pull request #11501 from rouault/fix_11500
Browse files Browse the repository at this point in the history
Doc: clarify that the OGR geometry model is SRS unaware
  • Loading branch information
rouault authored Dec 19, 2024
2 parents 49acea9 + d62d248 commit bb585c1
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 8 deletions.
3 changes: 2 additions & 1 deletion doc/source/user/vector_data_model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ Additional intermediate classes contain functionality that is used by multiple g

The :cpp:class:`OGRGeometryFactory` is used to convert well known text (WKT) and well known binary (WKB) format data into the appropriate :cpp:class:`OGRGeometry` subclass. These are predefined ASCII and binary formats for representing all the types of simple features geometries.

The :cpp:class:`OGRGeometry` includes a reference to an :cpp:class:`OGRSpatialReference` object, defining the spatial reference system of that geometry. This is normally a reference to a shared spatial reference object with reference counting for each of the :cpp:class:`OGRGeometry` objects using it.
The :cpp:class:`OGRGeometry` includes a reference to an :cpp:class:`OGRSpatialReference` object, defining the spatial reference system of that geometry. This is normally a reference to a shared spatial reference object with reference counting for each of the :cpp:class:`OGRGeometry` objects using it. Note however that in the general case, all geometric processing done by GDAL is done in a planar way, ignoring potential discontinuity issues at the poles or the antimeridian. :cpp:func:`OGRGeometryFactory::transformWithOptions` can be used in some cases to split geometries at the poles or the antimeridian.

While it is theoretically possible to derive other or more specific geometry classes from the existing :cpp:class:`OGRGeometry` classes, this isn't an aspect that has been well thought out. In particular, it would be possible to create specialized classes using the :cpp:class:`OGRGeometryFactory` without modifying it.


Compatibility issues with non-linear geometries
+++++++++++++++++++++++++++++++++++++++++++++++

Expand Down
38 changes: 31 additions & 7 deletions ogr/ogrgeometryfactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3921,9 +3921,31 @@ bool OGRGeometryFactory::isTransformWithOptionsRegularTransform(
/************************************************************************/

/** Transform a geometry.
*
* This is an enhanced version of OGRGeometry::Transform().
*
* When reprojecting geometries from a Polar Stereographic projection or a
* projection naturally crossing the antimeridian (like UTM Zone 60) to a
* geographic CRS, it will cut geometries along the antimeridian. So a
* LineString might be returned as a MultiLineString.
*
* The WRAPDATELINE=YES option might be specified for circumstances to correct
* geometries that incorrectly go from a longitude on a side of the antimeridian
* to the other side, like a LINESTRING(-179 0,179 0) will be transformed to
* a MULTILINESTRING ((-179 0,-180 0),(180 0,179 0)). For that use case, hCT
* might be NULL.
*
* Supported options in papszOptions are:
* <ul>
* <li>WRAPDATELINE=YES</li>
* <li>DATELINEOFFSET=longitude_gap_in_degree. Defaults to 10.</li>
* </ul>
*
* This is the same as the C function OGR_GeomTransformer_Transform().
*
* @param poSrcGeom source geometry
* @param poCT coordinate transformation object, or NULL.
* @param papszOptions options. Including WRAPDATELINE=YES and DATELINEOFFSET=.
* @param papszOptions NULL terminated list of options, or NULL.
* @param cache Cache. May increase performance if persisted between invocations
* @return (new) transformed geometry.
*/
Expand Down Expand Up @@ -4112,14 +4134,16 @@ struct OGRGeomTransformer
* a MULTILINESTRING ((-179 0,-180 0),(180 0,179 0)). For that use case, hCT
* might be NULL.
*
* Supported options in papszOptions are:
* <ul>
* <li>WRAPDATELINE=YES</li>
* <li>DATELINEOFFSET=longitude_gap_in_degree. Defaults to 10.</li>
* </ul>
*
* This is the same as the C++ method OGRGeometryFactory::transformWithOptions().
* @param hCT Coordinate transformation object (will be cloned) or NULL.
* @param papszOptions NULL terminated list of options, or NULL.
* Supported options are:
* <ul>
* <li>WRAPDATELINE=YES</li>
* <li>DATELINEOFFSET=longitude_gap_in_degree. Defaults
* to 10.</li>
* </ul>
* @return transformer object to free with OGR_GeomTransformer_Destroy()
* @since GDAL 3.1
*/
Expand Down

0 comments on commit bb585c1

Please sign in to comment.