Geography Reference
In-Depth Information
This returns an SVG tag ready to be inserted directly into your output or an SVG file.
If you're creating output for use in Google Earth or any other app that supports Keyhole
Markup Language, use the following function:
SELECT ST_AsKML(geometry)
If you're outputting industry-standard Geography Markup Language (GML) or GeoJSON (A
special format of JSON designed especially for geographic data),
SELECT ST_AsGML(geometry)
and
SELECT ST_AsGeoJSON(geometry)
will be your functions.
Some servers also provide other output functions on top of that, such as the following
Postgres function:
SELECT ST_AsLatLonText(geometry)
This outputs coordinates in NMEA seconds, minutes, and degrees format, but the use of this
is considered non-standard and may make it hard to port your application between database
platforms.
Let's have a quick look at one or two of these functions using the cities point data we added
to our database. To do this, we'll use the SQL editor in pgAdmin. To open the SQL editor,
select the database you wish to work in— in our case the GISBook one if you've been
following along—and click on the SQL magnifying glass icon on the toolbar.
Figure 47: SQL Editor Icon
Search WWH ::




Custom Search