Subscribe to this thread
Home - General / All posts - Select points contained in areas where an additional parameter is met stuck in M9
Graeme

991 post(s)
#27-Aug-23 07:03

Did a Forum search for "select contained in and" but nothing obvious came to light.

This auto-generated M9 query selects points in "points dwg", contained in a selected area in "areas dwg". Sorry, can't seem to "remove formatting" below so everything looks like "code", how is that done?

-- $manifold$

--

-- Auto-generated

--

-- Spatial

--   Layer: Points Drawing

--   Field: Geom

--   Operation: contained

--   Overlay: Areas Drawing

--   Overlay selection only: TRUE

--

VALUE @drawing TABLE = CALL ComponentFieldDrawing([Points Drawing]'Geom');

VALUE @overlay TABLE = CALL Selection([Areas Drawing]TRUE);

TABLE CALL GeomOverlayContainingFilterPar(@drawing, @overlay, 0, ThreadConfig(SystemCpuCount()));

Terrific, but I'm struggling to add the equivalent of a M8 "where" clause:

--M8

SELECT [Areas Dwg].[id],[Areas Dwg].[IntField] FROM [Areas Dwg],[Points Dwg]

WHERE

CONTAINS([Areas Dwg].[id],[Points Dwg].[id])

AND [Points Dwg].[IntField]<>[Areas Dwg].[IntField];

Is it even possible to edit the autogenerated M9 code in this way? I've tried to add this to the M9 query in several places without success:

M9--WHERE [Areas Dwg].[IntField]<>[Points Dwg].[IntField]

atrushwo108 post(s)
#30-Aug-23 20:40

Try this

SELECT *

FROM [AREAS] AS [1]

INNER JOIN [POINTS] AS [2] ON GEOMCONTAINS([1].[GEOM],[2].[GEOM],0)

WHERE [1].[INTFIELD] <> [2].[INTFIELD]

Manifold User Community Use Agreement Copyright (C) 2007-2021 Manifold Software Limited. All rights reserved.