Tools to convert and parse GPS coordinates. More...
Import Statement: | import ArcGIS.AppFramework.Sql 1.0 |
Properties
- availableConvertFormats : QStringList
- availableParseFormats : QStringList
Methods
- object convert(qgeocoordinate coordinate, string format)
- object convert(qgeocoordinate coordinate, string format, object options)
- object parse(string text)
- object parse(string text, object options)
Detailed Description
The Coordinate component provides methods to either parse a text representation of geographic coordinates into a valid location format, as well as methods to convert a location value between different coordinate formats. This component is a singleton, and as such does not need to be instantiated.
The following code sample demonstrates a potential usage of the Coordinate component. The center of the map provides a value that is converted into the coordinate output below, while the text field above the map can be used to enter a coordinate in text, that will be parsed as a valid coordinate value that the map will zoom to.
Map { id: map plugin: Plugin { preferred: [ "esri" ] } center: QtPositioning.coordinate( 34.057252, -117.194581 ) zoomLevel: 17 copyrightsVisible: false TextField { width: parent.width text: "34°03.4351'N 117°11.6749'W" // geographic (dd, dms, ddm), geouri, srs, utm and mgrs placeholderText: qsTr( "Enter coordinate" ) validator: InputValidator { validate: function ( input ) { let info = Coordinate.parse( input ); return info.coordinateValid ? InputValidator.Acceptable : InputValidator.Intermediate; } } onAccepted: { let info = Coordinate.parse( text ); map.center = QtPositioning.coordinate( info.coordinate.latitude, info.coordinate.longitude ); } } Text { anchors.bottom: parent.bottom width: parent.width text: coordinateToDMS( map.center ) } function coordinateToDMS( coordinate ) { let format = "dms"; // mgrs, utm, ups, universalGrid, srs, dd, ddm, dms let options = { precision: 4 }; let info = Coordinate.convert( coordinate, format, options ); return info.dms.latitudeText + " " + info.dms.longitudeText; } }
Property Documentation
A list of available formats to convert GPS values into. The following formats are supported by the AppFramework:
Output | Description |
---|---|
mgrs | Military Grade Reference System |
utm | Universal Tranverse Mercator |
ups | Universal Polar Stereographic |
universalGrid | Universal Grid (returns either UTM or UPS depending on which is applicable) |
srs | Spatial Reference System |
dd | Decimal degrees |
ddm | Degrees decimal minutes |
dms | Degrees minutes seconds |
A list of available formats to convert a string interpretation of a GPS coordinate as. The following formats are supported by the AppFramework:
Output | Description |
---|---|
mgrs | Military Grade Reference System |
utm | Universal Tranverse Mercator |
srs | Spatial Reference System |
geographic | Geographic coordinate system |
geouri | Geo URI scheme |
Method Documentation
Converts the provided GPS coordinate into the given format.
The coordinate parameter
The GPS coordinate to convert into a new format.
The format parameter
The output format for the GPS coordinate to convert.
Converts the provided GPS coordinate into the given format. Certain output formats can also accept other properties that can be set in the options parameter.
The coordinate parameter
The GPS coordinate to convert into a new format.
The format parameter
The output format for the GPS coordinate to convert.
The options parameter
If there are options available for the output format you are using, provide them here.
For SRS, you can provide an SRID to declare if your coordinate is to be output in geographic coordinates or web mercator. For DD, DDM or DMS, you can provide a precision value to determine the amount of decimal places that the values will be rounded to.
Parses a text string as a GPS coordinate.
The text parameter
The text string to parse as a GPS coordinate.
Parses a text string as a GPS coordinate, adhering to the provided options.
The text parameter
The text string to parse as a GPS coordinate.
The options parameter