Gunion - need help with it

30 views
Skip to first unread message

tor

unread,
May 23, 2009, 11:50:58 AM5/23/09
to SpatiaLite Users
Hi all,

I have been following the Spatialite tutorial. The tutorial is very
good but I have problems when trying to introduce Gunion in my SQL
queries. The following Select statement works as expected:

SELECT PK_UID, Name FROM NewRegions WHERE MBROverlaps(BuildMBR(654000,
4692000, 770000, 4924000), Geometry)

But I would like to Gunion the MBR (as shown above) with the
geometries of the NewRegions so that the NewRegions will be clipped to
the MBR. I do not know how to extend the SELECT statement above so
that the returned polygons will be "clipped" as I have described
above. As I understand from the Tutorial this should be possible to
do. I would really appreciate if sombody could help me here.

Thx,
tor

Keith

unread,
May 24, 2009, 5:43:33 PM5/24/09
to SpatiaLite Users
Hi Tor,

The clip function is called Difference in Spatialite. Here is a simple
example - select Difference(layer1.geometry,layer2.geometry) as
geometry from layer1,layer2 where intersects
(layer1.geometry,layer2.geometry). The Gunion function acts like
Dissolve.

Keith

tor

unread,
May 25, 2009, 9:15:25 AM5/25/09
to SpatiaLite Users
Hi Keith,

Thanks a lot for your help. That was what I needed.

For you and others who might be interested in my implementation of the
SQL insert / query here it is:

INSERT INTO DRAWING_A(PK_UID,ID,SMALL_SQUA,Geometry) VALUES
('3','3','Area_Of_Interest',(
SELECT Difference(DRAWING_A.Geometry, DRAWING_B.Geometry) as
Geometry from DRAWING_A, DRAWING_B where Intersects
(DRAWING_A.Geometry, DRAWING_A.Geometry)));

Thx,
tor
> > tor- Dölj citerad text -
>
> - Visa citerad text -
Reply all
Reply to author
Forward
0 new messages