May 2017
Beginner to intermediate
328 pages
7h 17m
English
The rules for composing LineStrings are similar to those governing MultiPoint composition: Two points, an array of points, or a set of aggregated rows can be supplied. The PostGIS function designed for creating LineStrings is called ST_MakeLine. Point geometries required for composition can be already stored in a table, or created from raw coordinates using the ST_MakePoint function.
The following example will create a straight line connecting two points:
SELECT ST_MakeLine(ST_MakePoint(20,50),ST_MakePoint(19.95,49.98));
When using raw coordinates, the output geometry will have an unknown SRID, so the complete example will be as follows:
SELECT ST_SetSRID(ST_MakeLine(ST_MakePoint(20,50),ST_MakePoint(19.95,49.98)),4326); ...
Read now
Unlock full access