[postgis-users] basic functionalities of PostGIS
Ben Madin
lists at remoteinformation.com.au
Mon Jan 3 18:05:52 PST 2011
Apostolis,
On 04/01/2011, at 4:55 AM, ΑΠΟΣΤΟΛΟΣ ΛΕΛΕΝΤΖΗΣ wrote:
> Indeed, i understand the power of spatial SQL, but now i am a beginner, and i need a lot of work.
>
> As i mentioned, i want to union two layers, typing a spatial SQL query.
> I want to take the same result, if i use the tool union of ArcGIS. But, i don't like to talk with terminal of ArcGIS, so i want to execute one of the classic spatial action, namely UNION (A or B).
> Because, i can't type the right command..could you help me???
It is fairly well documented, but this example unions two polygons (A Red, B Green).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: st_union.png
Type: image/png
Size: 13193 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20110104/02668c96/attachment.png>
-------------- next part --------------
SELECT ST_AsText(
ST_Union(
ST_GeomFromText(
'POLYGON (( 1 1,1 3, 3 3 ,3 1,1 1))' -- Polygon A
),
ST_GeomFromText(
'POLYGON((2 2, 2 4, 4 4, 4 2, 2 2))' -- Polygon B
)
)
);
st_astext
------------------------------------------------
POLYGON((1 1,1 3,2 3,2 4,4 4,4 2,3 2,3 1,1 1))
(1 row)
More information about the postgis-users
mailing list