Skip to content

Commit d4ea95e

Browse files
committed
Improve QgsCoordinateReferenceSystem documentation
1 parent 9e292d0 commit d4ea95e

File tree

2 files changed

+116
-96
lines changed

2 files changed

+116
-96
lines changed

python/core/qgscoordinatereferencesystem.sip

+52-42
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class QgsCoordinateReferenceSystem
3333

3434
/** Use this constructor when you want to create a CRS object using
3535
* a postgis SRID, an EpsgCrsId id or a QGIS CRS_ID.
36-
* @note We encourage you to use EpsgCrsId, Wkt or Proj4 to describe CRS's in your code
36+
* @note We encourage you to use EpsgCrsId, WKT or Proj4 to describe CRS's in your code
3737
* wherever possible. QGSI CRS_IDs are not guaranteed to be permanent / involatile.
3838
* @param theId The ID no valid for the chosen coordinate system id type
3939
* @param theType One of the types described in QgsCoordinateReferenceSystem::CrsType
@@ -53,27 +53,27 @@ class QgsCoordinateReferenceSystem
5353
*/
5454
bool createFromOgcWmsCrs( QString theCrs );
5555

56-
/** Set up this srs by fetching the appropriate information from the
56+
/** Set up this CRS by fetching the appropriate information from the
5757
* sqlite backend. First the system level read only srs.db will be checked
5858
* and then the users ~/.qgis/qgis.db database will be checked for a match.
5959
* @note Any members will be overwritten during this process.
6060
* @param theSrid The postgis SRID for the desired spatial reference system.
6161
*/
6262
bool createFromSrid( const long theSrid );
6363

64-
/** Set up this srs using a Wkt spatial ref sys definition.
65-
* The wkt will be converted to a proj4 string using OGR helper
66-
* functions. After this the srs databasses will be searched for matches.
64+
/** Set up this CRS using a WKT spatial ref sys definition.
65+
* The WKT will be converted to a proj4 string using OGR helper
66+
* functions. After this the SRS databases will be searched for matches.
6767
* First the system level read only srs.db will be checked
6868
* and then the users ~/.qgis/qgis.db database will be checked for a match.
6969
* @note Any members will be overwritten during this process.
70-
* @note SRID and EpsgCrsId may be blank if no match can be found on srs db.
71-
* @param theWkt The Wkt for the desired spatial reference system.
70+
* @note SRID and EpsgCrsId may be blank if no match can be found on SRS db.
71+
* @param theWkt The WKT for the desired spatial reference system.
7272
* @return bool TRUE if success else false
7373
*/
7474
bool createFromWkt( const QString &theWkt );
7575

76-
/** Set up this srs by fetching the appropriate information from the
76+
/** Set up this CRS by fetching the appropriate information from the
7777
* sqlite backend. If the srsid is < 100000, only the system srs.db
7878
* will be checked. If the srsid > 100000 the srs will be retrieved from
7979
* the ~/.qgis/qgis.db
@@ -83,7 +83,7 @@ class QgsCoordinateReferenceSystem
8383
*/
8484
bool createFromSrsId( const long theSrsId );
8585

86-
/** Set up this srs by passing it a proj4 style formatted string.
86+
/** Set up this CRS by passing it a proj4 style formatted string.
8787
* The string will be parsed and the projection and ellipsoid
8888
* members set and the remainder of the proj4 string will be stored
8989
* in the parameters member. The reason for this is so that we
@@ -94,7 +94,7 @@ class QgsCoordinateReferenceSystem
9494
*
9595
* We try to match the proj string to and srsid using the following logic:
9696
*
97-
* - perform a whole text search on srs name (if not null). The srs name will
97+
* - perform a whole text search on CRS name (if not null). The CRS name will
9898
* have been set if this method has been delegated to from createFromWkt.
9999
* - if the above does not match perform a whole text search on proj4 string (if not null)
100100
* - if none of the above match convert the proj4 string to an OGR CRS
@@ -111,7 +111,7 @@ class QgsCoordinateReferenceSystem
111111
*/
112112
bool createFromProj4( const QString &theProjString );
113113

114-
/** Set up this srs from a string definition, by default a WKT definition. Otherwise
114+
/** Set up this CRS from a string definition, by default a WKT definition. Otherwise
115115
* the string defines a authority, followed by a colon, followed by the definition.
116116
* The authority can be one of "epsg", "postgis", "internal" for integer definitions,
117117
* and "wkt" or "proj4" for string definitions. The implementation of each authority
@@ -120,7 +120,7 @@ class QgsCoordinateReferenceSystem
120120
*/
121121
bool createFromString( const QString &theDefinition );
122122

123-
/** Set up this srs from a various text formats.
123+
/** Set up this CRS from a various text formats.
124124
*
125125
* Valid formats: WKT string, "EPSG:n", "EPSGA:n", "AUTO:proj_id,unit_id,lon0,lat0",
126126
* "urn:ogc:def:crs:EPSG::n", PROJ.4 string, filename (with WKT, XML or PROJ.4 string),
@@ -145,7 +145,7 @@ class QgsCoordinateReferenceSystem
145145
*/
146146
static void setupESRIWktFix();
147147

148-
/** Find out whether this CRS is correctly initialised and usable */
148+
/** Returns whether this CRS is correctly initialised and usable */
149149
bool isValid() const;
150150

151151
/** Perform some validation on this CRS. If the sts doesn't validate the
@@ -155,7 +155,7 @@ class QgsCoordinateReferenceSystem
155155
* if that involves resorting to a hard coded default of geocs:wgs84.
156156
*
157157
* @note It is not usually necessary to use this function, unless you
158-
* are trying to force this srs to be valid.
158+
* are trying to force this CRS to be valid.
159159
*/
160160
void validate();
161161

@@ -219,65 +219,75 @@ class QgsCoordinateReferenceSystem
219219

220220
// Accessors -----------------------------------
221221

222-
/** Get the SrsId - if possible
223-
* @return long theSrsId The internal sqlite3 srs.db primary key for this srs
224-
*/
222+
/** Returns the SrsId, if available.
223+
* @return the internal sqlite3 srs.db primary key for this srs
224+
* @see postgisSrid()
225+
*/
225226
long srsid() const;
226227

227-
/** Get the postgis srid for this srs
228-
* @return long theSRID the Postgis spatial_ref_sys identifier for this srs (defaults to 0)
228+
/** Returns PostGIS SRID for the CRS.
229+
* @return the PostGIS spatial_ref_sys identifier for this CRS (defaults to 0)
229230
*/
230231
long postgisSrid() const;
231232

232-
/** Get the authority identifier for this srs
233-
* @return QString the Authority identifier for this srs
233+
/** Returns the authority identifier for the CRS, which includes both the authority (eg EPSG)
234+
* and the CRS number (eg 4326). This is the best method to use when showing a very short CRS
235+
* identifier to a user, eg "EPSG:4326".
236+
* @returns the authority identifier for this CRS
237+
* @see description()
234238
*/
235239
QString authid() const;
236240

237-
/** Get the Description
238-
* @return QString the Description A textual description of the srs.
239-
* @note A zero length string will be returned if the description is uninitialised
241+
/** Returns the descriptive name of the CRS, eg "WGS 84" or "GDA 94 / Vicgrid94". In most
242+
* cases this is the best method to use when showing a friendly identifier for the CRS to a
243+
* user.
244+
* @returns descriptive name of the CRS
245+
* @note an empty string will be returned if the description is not available for the CRS
246+
* @see authid()
240247
*/
241248
QString description() const;
242249

243-
/** Get the Projection Acronym
244-
* @return QString theProjectionAcronym The official proj4 acronym for the projection family
245-
* @note A zero length string will be returned if the projectionAcronym is uninitialised
250+
/** Returns the projection acronym for the projection used by the CRS.
251+
* @returns the official proj4 acronym for the projection family
252+
* @note an empty string will be returned if the projectionAcronym is not available for the CRS
253+
* @see ellipsoidAcronym()
246254
*/
247255
QString projectionAcronym() const;
248256

249-
/** Get the Ellipsoid Acronym
250-
* @return QString theEllipsoidAcronym The official proj4 acronym for the ellipoid
251-
* @note A zero length string will be returned if the ellipsoidAcronym is uninitialised
257+
/** Returns the ellipsoid acronym for the ellipsoid used by the CRS.
258+
* @returns the official proj4 acronym for the ellipoid
259+
* @note an empty string will be returned if the ellipsoidAcronym is not available for the CRS
260+
* @see projectionAcronym()
252261
*/
253262
QString ellipsoidAcronym() const;
254263

255-
/** A helper to get an wkt representation of this srs
256-
* @return string containing Wkt of the srs
264+
/** Returns a WKT representation of this CRS.
265+
* @return string containing WKT of the CRS
266+
* @see toProj4()
257267
*/
258268
QString toWkt() const;
259269

260-
/** Get the Proj Proj4 string representation of this srs.
270+
/** Returns a Proj4 string representation of this CRS.
261271
* If proj and ellps keys are found in the parameters,
262-
* they will be stripped out and the Projection and ellipsoid acronyms will be
272+
* they will be stripped out and the projection and ellipsoid acronyms will be
263273
* overridden with these.
264-
* @return QString theProj4String Proj4 format specifies that define this srs.
265-
* @note A zero length string will be returned if the toProj4 is uninitialised
274+
* @return Proj4 format string that defines this CRS.
275+
* @note an empty string will be returned if the CRS could not be represented by a Proj4 string
276+
* @see toWkt()
266277
*/
267278
QString toProj4() const;
268279

269-
/** Get this Geographic? flag
270-
* @return bool theGeoFlag Whether this is a geographic or projected coordinate system
280+
/** Returns whether the CRS is a geographic CRS.
281+
* @returns true if CRS is geographic, or false if it is a projected CRS
271282
*/
272283
bool geographicFlag() const;
273284

274-
/** Return if axis is inverted (eg. for WMS 1.3)
275-
* @return bool Whether this is crs axis is inverted
285+
/** Returns whether axis is inverted (eg. for WMS 1.3) for the CRS.
286+
* @returns true if CRS axis is inverted
276287
*/
277288
bool axisInverted() const;
278289

279-
/** Get the units that the projection is in
280-
* @return QGis::UnitType that gives the units for the coordinate system
290+
/** Returns the units for the projection used by the CRS.
281291
*/
282292
QGis::UnitType mapUnits() const;
283293

0 commit comments

Comments
 (0)