Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add description for ST_PointOnSurface and comparison example between ST_PointOnSurface and ST_Centroid #207

Merged
merged 4 commits into from
May 19, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions _includes/centroid-pointonsurface-cf.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{% highlight mysql %}
CREATE TABLE input(geom GEOMETRY);
INSERT INTO input VALUES(
'POLYGON((0 0, 5 0, 5 1, 1 1, 1 4, 5 4, 5 5, 0 5, 0 0))');
SELECT ST_PointOnSurface(geom) POINT,
ST_Centroid(geom) CENTROID FROM input;
-- Answer:
-- | POINT | CENTROID |
-- |-----------------|--------------------------------|
-- | POINT (0.5 2.5) | POINT (2.0384615384615383 2.5) |

{% endhighlight %}

<img class="displayed" src="../ST_PointOnSurface.png"/>
4 changes: 4 additions & 0 deletions docs/dev/ST_Centroid.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ SELECT ST_Centroid('GEOMETRYCOLLECTION(

<img class="displayed" src="../ST_Centroid_4.png"/>

##### Comparison with [`ST_PointOnSurface`](../ST_PointOnSurface)

{% include centroid-pointonsurface-cf.html %}

##### See also

* [`ST_PointOnSurface`](../ST_PointOnSurface)
* <a href="https://github.com/irstv/H2GIS/blob/master/h2spatial/src/main/java/org/h2gis/h2spatial/internal/function/spatial/properties/ST_Centroid.java" target="_blank">Source code</a>
37 changes: 34 additions & 3 deletions docs/dev/ST_PointOnSurface.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,59 @@
layout: docs
title: ST_PointOnSurface
category: h2spatial/properties
description:
description: Return a <code>POINT</code> that lie on the surface of a Geometry
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

third person conjugation ...
I'll fix it

prev_section: ST_PointN
next_section: ST_SRID
permalink: /docs/dev/ST_PointOnSurface/
---

### Signatures
### Signature

{% highlight mysql %}
POINT ST_InteriorPoint(GEOMETRY geom);
{% endhighlight %}

### Description


Returns a `POINT` that lie on the surface of a Geometry. If it's impossible to calculate the surface of a Geometry, the point may lie on the boundary of the Geometry.
The returned point is always the same for the same Geometry.

{% include sfs-1-2-1.html %}

### Examples

{% highlight mysql %}
SELECT ST_PointOnSurface('POINT(1 5)');
-- Answer: POINT(1 5)

SELECT ST_PointOnSurface('MULTIPOINT((4 4), (1 1), (1 0),
(0 3)))');
-- Answer: POINT(1 1)

SELECT ST_PointOnSurface('LINESTRING(-1 5, 0 10)');
-- Answer: POINT(0 10)

SELECT ST_PointOnSurface('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))');
-- Answer: POINT(2.5 2.5)
{% endhighlight %}

<img class="displayed" src="../ST_PointOnSurface_1.png"/>

{% highlight mysql %}
SELECT ST_PointOnSurface('GEOMETRYCOLLECTION(
POLYGON((1 2, 4 2, 4 6, 1 6, 1 2)),
LINESTRING(2 6, 6 2),
MULTIPOINT((4 4), (1 1), (0 3)))');
-- Answer: POINT(2.5 4)
{% endhighlight %}

<img class="displayed" src="../ST_PointOnSurface_2.png"/>

##### Comparison with [`ST_Centroid`](../ST_Centroid)

{% include centroid-pointonsurface-cf.html %}

##### See also

* [`ST_Centroid`](../ST_Centroid)
* <a href="https://github.com/irstv/H2GIS/blob/master/h2spatial/src/main/java/org/h2gis/h2spatial/internal/function/spatial/properties/ST_PointOnSurface.java" target="_blank">Source code</a>
Binary file added docs/dev/ST_PointOnSurface.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading