Spatial Type singleton. More...

Import Statement: import ArcGIS.AppFramework.Sql 1.0




Detailed Description

The ST (Spatial Type) component contains methods for geometry construction and projection. This is a singleton component, meaning it does not need to be instantiated.

This code sample imports a spatial reference system from SqlDatabase into ST, by writing it into the spatialReferenceDatabase property. A specific record is then printed into the console log using the spatialReference method.

Item {
        SqlDatabase {
                id: db

                databaseName: ":memory:"

        Component.onCompleted: {

                db.query( [
                        "CREATE TABLE SPATIAL_REF_SYS ( ",
                        "    SRID INTEGER NOT NULL PRIMARY KEY,",
                        "    AUTH_NAME VARCHAR(256),",
                        "    AUTH_SRID INTEGER,",
                        "    SRTEXT VARCHAR(2048),",
                        "    PROJ4TEXT VARCHAR(2048)",
                        ");" ].join("\n")

                db.query( [
                        "INSERT into spatial_ref_sys ",
                        "(srid, auth_name, auth_srid, proj4text, srtext) ",
                        "values ( ",
                        "94326, ",
                        "'epsg', ",
                        "4326, ",
                        "'+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs ', ",
                        "'GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.01745329251994328,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4326\"]]');",
                ].join("\n") );

                ST.spatialReferenceDatabase = db;

                console.log(JSON.stringify(ST.spatialReference(94326), undefined, 2));

                // The expected console output from this code sample:
                // {
                //   "AUTH_NAME": "epsg",
                //   "AUTH_SRID": 4326,
                //   "PROJ4TEXT": "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs ",
                //   "SRID": 94326,
                //   "SRTEXT": "GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.01745329251994328,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4326\"]]"
                // }


Property Documentation

projectionDataPaths : QStringList

Search paths containing a list of directories for init and grid shift files.

spatialReferenceDatabase : SqlDatabase

Reads or sets the SQLite database containing the Open Geospatial Consortium (OGC) spatial_ref_sys table.

Signal Documentation


Signal emitted when the spatial reference database has changed.

Method Documentation


Clears the geometric projection cache.

object geometry(data)

Creates a geometric object.

The data parameter

The geometric object created.

ST_Point point(text)

Attempts to return a new Point geometry. If unsuccessful, returns an invalid point.

The text parameter

Well-known text (WKT) representation of a point geometry.

ST_Point point(coordinate)

Returns a new Point geometry from a QtPositioning coordinate.

The coordinate parameter

A coordinate value from QtPositioning.

ST_Point point(x, double y)

Returns a new Point geometry defined by the x and y parameters.

The x parameter

The x (latitude) value of the point.

The y parameter

The y (longitude) value of the point.

ST_Point point(x, double y, int srid)

Returns a new point geometry defined by the x, y, and spatial reference parameters.

The x parameter

The x (latitude) value of the point.

The y parameter

The y (longitude) value of the point.

The srid parameter

The spatial reference of the returned point.

ST_Projection projection(srid)

Returns the projection associated with the given spatial reference ID. If spatial reference ID is invalid, returns null.

The srid parameter

The spatial reference ID of the projection.

var spatialReference(srid)

Retrieves a record from the spatial_ref_sys table from the spatialReferenceDatabase as an object.

The srid parameter

The spatial reference to look up.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.