Returns a string representing a geometry in JSON format.
geometry-expression.ST_AsGeoJSON([ format])
Name | Type | Description |
---|---|---|
format |
VARCHAR(128) |
A string defining parameters controlling how the GeoJSON result is generated. If not specified, the default is 'GeoJSON'. |
LONG VARCHAR Returns the GeoJSON representation of the geometry-expression.
The GeoJSON standard defines a geospatial interchange format based on the JavaScript Object Notation (JSON). This format is suited to web-based applications and it can provide a format that is more concise and easier to interpret than WKT or WKB. See http://geojson.org/geojson-spec.html.
The ST_AsGeoJSON method returns a text string representing the geometry. A number of different text formats are supported (with associated options) and the desired format is selected using the optional format parameter. If the format parameter is not specified, the default is 'GeoJSON'.
The format string defines an output format and parameters to the format. The format string has one of the following formats:
format-name |
format-name(parameter1=value1;parameter2=value2;...) |
parameter1=value1;parameter2=value2;... |
The first format specifies the format name and no parameters. All format parameters use their default values. The second format specifies the format name and a list of named parameter values. Parameters that are not supplied use their default values. The last format specifies only parameter values, and the format name defaults to 'GeoJSON'.
The following format names may be used:
GeoJSON The GeoJSON format uses JavaScript Object Notation (JSON) as defined by http://geojson.org/geojson-spec.html.
Format Name | Parameter Name | Default Value | Allowed Values | Description |
---|---|---|---|---|
GeoJSON | Version | 1.0 | 1.0 | The version of the GeoJSON specification to follow. At present, only 1.0 is supported. |
By default, ST_AsGeoJSON uses the original format for a geometry, if it is available. Otherwise, the internal format is used. For more information about internal and original formats, see STORAGE FORMAT clause, CREATE SPATIAL REFERENCE SYSTEM statement.
SQL/MM (ISO/IEC 13249-3: 2006) Vendor extension
The following example returns the result {"type":"Point", "coordinates":[1,2]}
.
SELECT NEW ST_Point( 1.0, 2.0, 3.0, 4.0, 4326 ).ST_AsGeoJSON() |
Discuss this page in DocCommentXchange.
|
Copyright © 2012, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.1 |