Skip to content

Commit

Permalink
Merge pull request orbisgis#736 from gpetit/gh-pages
Browse files Browse the repository at this point in the history
Add a doc for ST_AsGML function
  • Loading branch information
ebocher authored Dec 6, 2016
2 parents 91ab080 + 778d4d1 commit 8545417
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/dev/ST_AsBinary.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ category: geom2D/geometry-conversion
is_function: true
description: Geometry → Well Known Binary
prev_section: geom2D/geometry-conversion
next_section: ST_AsText
next_section: ST_AsGML
permalink: /docs/dev/ST_AsBinary/
---

Expand Down
113 changes: 113 additions & 0 deletions docs/dev/ST_AsGML.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
---
layout: docs
title: ST_AsGML
category: geom2D/geometry-conversion
is_function: true
description: Geometry → GML
prev_section: ST_AsBinary
next_section: ST_AsText
permalink: /docs/dev/ST_AsGML/
---

### Signature

{% highlight mysql %}
GEOMETRY ST_AsGML(GEOMETRY geom);
{% endhighlight %}

### Description

Store a geometry (`geom`) as a GML representation.

This function supports:

* only GML 2.1.2
* 3D coordinates
* Multi-geometries

### Examples

##### For a Point
{% highlight mysql %}
SELECT ST_AsGML('POINT(-2.070365 47.643713)');
-- Answer:
-- <gml:Point srsName='EPSG:0'>
-- <gml:coordinates>
-- -2.070365,47.643713
-- </gml:coordinates>
-- </gml:Point>
{% endhighlight %}

##### For a (3D) Linestring
{% highlight mysql %}
SELECT ST_AsGML('LINESTRING (12 25 10, 100 20 5, 56 65 8)');
-- Answer:
-- <gml:LineString srsName='EPSG:0'>
-- <gml:coordinates>
-- 12.0,25.0,10.0 100.0,20.0,5.0 56.0,65.0,8.0
-- </gml:coordinates>
-- </gml:LineString>
{% endhighlight %}

##### For a Linestring with a srid (here in WGS84)
{% highlight mysql %}
SELECT ST_AsGML(ST_SetSRID('LINESTRING (-47.8 56.3, -44.2 57.3)', 4326));
-- Answer:
-- <gml:LineString srsName='EPSG:4326'>
-- <gml:coordinates>
-- -47.8,56.3 -44.2,57.3
-- </gml:coordinates>
-- </gml:LineString>
{% endhighlight %}

##### For a Polygon
{% highlight mysql %}
SELECT ST_AsGML('POLYGON ((20 20, 40 20, 40 10, 20 10, 20 20))');
-- Answer:
-- <gml:Polygon srsName='EPSG:0'>
-- <gml:outerBoundaryIs>
-- <gml:LinearRing>
-- <gml:coordinates>
-- 20.0,20.0 40.0,20.0 40.0,10.0 20.0,10.0 20.0,20.0
-- </gml:coordinates>
-- </gml:LinearRing>
-- </gml:outerBoundaryIs>
-- </gml:Polygon>
{% endhighlight %}

##### For a MultiPolygon
{% highlight mysql %}
SELECT ST_AsGML('MULTIPOLYGON (((1 1, 1 3, 3 3, 3 1, 1 1)),
((4 2, 4 4, 6 4, 6 2, 4 2)))');
-- Answer:
-- <gml:MultiPolygon srsName='EPSG:0'>
-- <gml:polygonMember>
-- <gml:Polygon>
-- <gml:outerBoundaryIs>
-- <gml:LinearRing>
-- <gml:coordinates>
-- 1.0,1.0 1.0,3.0 3.0,3.0 3.0,1.0 1.0,1.0
-- </gml:coordinates>
-- </gml:LinearRing>
-- </gml:outerBoundaryIs>
-- </gml:Polygon>
-- </gml:polygonMember>
-- <gml:polygonMember>
-- <gml:Polygon>
-- <gml:outerBoundaryIs>
-- <gml:LinearRing>
-- <gml:coordinates>
-- 4.0,2.0 4.0,4.0 6.0,4.0 6.0,2.0 4.0,2.0
-- </gml:coordinates>
-- </gml:LinearRing>
-- </gml:outerBoundaryIs>
-- </gml:Polygon>
-- </gml:polygonMember>
-- </gml:MultiPolygon>
{% endhighlight %}

##### See also

* [`ST_GeomFromGML`](../ST_GeomFromGML)

* <a href="https://github.com/orbisgis/h2gis/blob/master/h2gis-functions/src/main/java/org/h2gis/functions/spatial/convert/ST_AsGML.java" target="_blank">Source code</a>
2 changes: 1 addition & 1 deletion docs/dev/ST_AsText.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: ST_AsText
category: geom2D/geometry-conversion
is_function: true
description: Alias for <code>ST_AsWKT</code>
prev_section: ST_AsBinary
prev_section: ST_AsGML
next_section: ST_AsWKT
permalink: /docs/dev/ST_AsText/
---
Expand Down

0 comments on commit 8545417

Please sign in to comment.