12.07.2015 Views

PostGIS 1.5.8 Manual - Fedora Project Packages GIT repositories

PostGIS 1.5.8 Manual - Fedora Project Packages GIT repositories

PostGIS 1.5.8 Manual - Fedora Project Packages GIT repositories

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>PostGIS</strong> <strong>1.5.8</strong> <strong>Manual</strong>145 / 310text ST_AsGeoJSON(geography g1, integer max_decimal_digits);text ST_AsGeoJSON(geometry g1, integer max_decimal_digits, integer options);text ST_AsGeoJSON(geography g1, integer max_decimal_digits, integer options);text ST_AsGeoJSON(integer gj_version, geometry g1);text ST_AsGeoJSON(integer gj_version, geography g1);text ST_AsGeoJSON(integer gj_version, geometry g1, integer max_decimal_digits);text ST_AsGeoJSON(integer gj_version, geography g1, integer max_decimal_digits);text ST_AsGeoJSON(integer gj_version, geometry g1, integer max_decimal_digits, integer options);text ST_AsGeoJSON(integer gj_version, geography g1, integer max_decimal_digits, integer options);DescriptionReturn the geometry as a Geometry Javascript Object Notation (GeoJSON) element. (Cf GeoJSON specifications 1.0). 2D and3D Geometries are both supported. GeoJSON only support SFS 1.1 geometry type (no curve support for example).The gj_version parameter is the major version of the GeoJSON spec. If specified, must be 1.The third argument may be used to reduce the maximum number of decimal places used in output (defaults to 15).The last ’options’ argument could be used to add Bbox or Crs in GeoJSON output:• 0: means no option (default value)• 1: GeoJSON Bbox• 2: GeoJSON Short CRS (e.g EPSG:4326)• 4: GeoJSON Long CRS (e.g urn:ogc:def:crs:EPSG::4326)Version 1: ST_AsGeoJSON(geom) / precision=15 version=1 options=0Version 2: ST_AsGeoJSON(geom, precision) / version=1 options=0Version 3: ST_AsGeoJSON(geom, precision, options) / version=1Version 4: ST_AsGeoJSON(version, geom) / precision=15 options=0Version 5: ST_AsGeoJSON(version, geom, precision) /options=0Version 6: ST_AsGeoJSON(version, geom, precision,options)Availability: 1.3.4Availability: 1.5.0 geography support was introduced.This function supports 3d and will not drop the z-index.ExamplesGeoJSON format is generally more efficient than other formats for use in ajax mapping. One popular javascript client thatsupports this is Open Layers. Example of its use is OpenLayers GeoJSON ExampleSELECT ST_AsGeoJSON(the_geom) from fe_edges limit 1;st_asgeojson-----------------------------------------------------------------------------------------------------{"type":"MultiLineString","coordinates":[[[-89.734634999999997,31.492072000000000],[-89.734955999999997,31.492237999999997]]]}(1 row)--3d pointSELECT ST_AsGeoJSON(’LINESTRING(1 2 3, 4 5 6)’);

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!