Geography Reference
In-Depth Information
Or we can get a specific point if the input is a LINESTRING or MULTILINESTRING .
SELECT AsText(ST_PointN(GeomFromText('LINESTRING(1 1,2 2,3 3,4 4)'),2))
Figure 64: Finding a Specific Point
The point output shown in the previous figure is the second point in our linestring.
If you need to know the bounding box of an object, you can easily get the x , y pairs of the
maximum and minimum extents by using the following code:
SELECT
name2,ST_Xmax(the_geom),ST_Ymax(the_geom),ST_Xmin(the_geom),ST_Ymin(the_geom) FROM
ukcountys WHERE name2 = 'Durham'
Figure 65: Maximum and Minimum Extents
Or if we need to perform measurements and other functions on our extents, we can get them
as an actual geometric rectangle.
SELECT name2,AsText(GeomFromText(box2d(the_geom)::geometry)) FROM ukcountys WHERE
name2 = 'Durham'
Figure 66: Extents Output as Geometric Rectangle
Lastly, let's imagine we have a segment of a path, represented by the following line:
LINE(1 1,10 10)
Search WWH ::




Custom Search