Subscribe to this thread
Home - General / All posts - GeomOverlayContainingPar
yves61
192 post(s)
#17-Nov-20 21:15

I am presently struggling with the GeomOverlayContaining(Par) functionality.

I have 2 maps : 'Map' and 'Map2'

Both maps have same source and overlay drawings and corresponding tables, except that drawings and tables within 'Map' are a smaller subset of the drawings and tables in 'Map2'

Running the queries qry_GeomOverlayContainingPar (on Map) and qry_GeomOverlayContainingPar_Map2 (on Map2) produce different results of 'targeted parcels' ( have a closer look within the 'detail area' for Map and Map2 ) although in essence both query actions are identical .

Am I missing something obvious or is this expected behaviour or a possible bug ?

Any advice is welcome.

Attachments:
M9_test_1.map

Dimitri


6,275 post(s)
online
#18-Nov-20 09:05

although in essence both query actions are identical

But the objects involved are radically different. The single object in Wbn_dp_merged is a very different object than the single object in Wbn_dp_merged2. That may have an effect when tolerance factors that are not a good fit to the data are used.

I haven't had a chance to look closely at this, except to note that when using auto tolerance, 0, the result seems to be the same in both cases and correct in both cases. Using the Layers pane to set transparency, with the "wbn" layers partially transparent above the "adp" layers, and altering colors a bit helps to make it clear where there are overlaps and where there are not.

Some questions...

1. What are you trying to accomplish, as an overall objective?

2. How was the Wbn_dp_merged2 object created?

3. How was the Wbn_dp_merged object created?

yves61
192 post(s)
#18-Nov-20 10:43

Dimitri,

I was just comparing the different ways M9 offers to achieve a goal and trying to understand what impact 'tolerance' possibly has in the GeomContains versus GeomOverlayContaining(Par) functions. ( and with Intersect and Adjacent functions too)

Now after a few more hours testing I come to the conclusion that using a tolerance of '0' in both queries returns equal result within the detailed area, (no question about this - that is what I expected ) butrunning both queries using a tolerance of '4' does not return equal results within the detailed area. How come ?

My first idea was that tolerance meant xxx measuring units corresponding with the drawing projection. So I would expect that running the query on a complete dataset or sub_dataset (clipped to a smaller area of interest) would return equal results if we just consider the smaller area of interest but it seems not.

I will try to post a new Map rearranged more clearly.

Dimitri


6,275 post(s)
online
#18-Nov-20 13:23

How come ?

Without thinking about it deeply, my guess is that expanding the "fuzziness" of the precision to four meters makes solutions indeterminate, and that just one is picked at random. After all, a tolerance of four meters is bigger than the "inside/outside" difference in the complicated object used as an overlay.

Suppose you have three doorways that are each one meter wide, with one meter between each doorway. Suppose you stand somewhere in front of the three doorways, and someone asks the question, "If we know the layout of the doorways give or take four meters, which doorway are you in front of?" Well, give or take four meters you can't tell what is a doorway and what is a wall between doorways, so you could be in front of any of the three or none of the three. Pick at random and you could get different results with exactly the same data.

would return equal results

I'd expect it to return equal results if a) there wasn't fuzziness that allowed more than one result to be picked at random, and if also b) the data were the same.

But even setting aside the fuzziness, the data aren't the same. The object that you use as an overlay is substantially different in the two different cases.

That's why I asked you questions 2 and 3 in my prior post, because besides the obvious visual differences I'm curious what process you used that might have also made the topology different.

You can see using very different objects for the overlay causes a difference in the results: Take your Wbn_dp_merged2 drawing layer from Map2 and use it in Map, rewriting your query for that map to use that layer (a single 2 character added to the VALUE ...):

VALUE @overlay TABLE = [Wbn_dp_merged2];

Run that query using the same overlay object in both cases and you'll see the results are identical when using a tolerance of 4 in both maps. [I've done a normalize and a topology : clean generalize on all the drawings involved, just in case there was some pathology left over from how they were created.]

It's interesting to note that the results are the same when using the same overlay, but why exactly the results are what they are I suspect is a matter of a possible fuzziness issue caused by using a tolerance that is larger than some of the defining features of the overlay, resulting in topological pathologies or unknowable shape. I don't know if part of what the auto setting does is to guard against fuzziness that makes a solution indeterminate in the case of deep pathology.

But it's a very interesting test case, and I bet it would certainly be useful for testing how algorithms work in extreme cases and either break down or don't when set up with parameters that cause unknowable shape or other pathology. I suspect that just trying it on Arc would crash it. :-)

yves61
192 post(s)
#18-Nov-20 14:30

Do I understand well that with a tolerance 0 GeomOverlayContaining(Par) will only take into account source objects that are 100% contained within or 100% equal to the overlay object(s). What is meant by automatic tolerance = 0 ?

-

What is the understanding if a tolerance of '4' would be used ?

--> Am I wrong to suppose that Overlay objects would get an extra outer buffer of 4 (metres) and consequently take into account only source objects that are 100% contained within or 100% equal to the overlay object(s) including the buffer of 4 m ? Is this understanding wrong ? Is it something else ?

yves61
192 post(s)
#18-Nov-20 15:02

I searched the M9 documentation .

What is tolerence standing for ? Tolerance against what / compared to what ? I did find clear explanation of what is understood by tolerance in the M9 documentation.

Tolerance = 0 as used within GeomOverlayContaining(Par) is something different than distance , isn't it ?

What is meant by automatic tolerance? What is it affecting ?

Dimitri


6,275 post(s)
online
#18-Nov-20 15:30

Am I wrong to suppose that Overlay objects would get an extra outer buffer of 4 (metres) and consequently take into account only source objects that are 100% contained within or 100% equal to the overlay object(s) including the buffer of 4 m ? Is this understanding wrong ? Is it something else ?

That is not a correct understanding. "Tolerance" is an epsilon value that says how close two coordinate locations must be to be considered coincident.

A tolerance of zero tells the system to use automatic tolerance, which is an estimate by the system for when coordinates would be far enough apart to be considered not coincident.

To decide if one object is inside another, you have to know where the boundaries are of both objects. Because digital representations of the world are not exact, there can be some slight give and take when vertices are not located at precisely the same places. Using a tolerance factor is a way of handling such microscopic differences. It's not a replacement for using buffers and generally isn't used at the macro level.

There are some situations where a tolerance value at a macro level might make sense, as in normalizing topologies so that points which are within, say, a meter of the end of a line are snapped to the end of the line. But overlays aren't one of those situations and using tolerance values that are larger than the distances between vertices that define objects doesn't make sense.

That's one reason why Manifold is dropping tolerance boxes from transforms, since the auto setting does a much better job.

adamw


9,445 post(s)
online
#30-Nov-20 13:56

Tolerance = 0 means that the computations will be done with the lowest tolerance possible. How low is this tolerance going to be depends on the data. Eg, if the coordinate values range from -100 to 100, the automatic tolerance is going to be 1000x lower than if they ranged from -100,000 to 100,000.

The value of the tolerance parameter is in the native units of the coordinate system. For lat/lon systems, that could be degrees. For metric systems, that's usually meters, or, say, feet. However, some coordinate systems have non-trivial scaling factors, shown as part of coordinate system metrics (at the bottom of the coordinate system dialog), they affect things as well. Ie, if the coordinate system is using meters, with the scales of 5x5 meters per unit, a tolerance value of 2 will mean 2x5=10 meters.

yves61
192 post(s)
#18-Nov-20 12:46

I have attached a new map. Hope this will be clearer now.

Have also a look at 'Comments' within the map.

Attachments:
M9_GeomOverlay.map

adamw


9,445 post(s)
online
#30-Nov-20 14:20

Looked at this briefly, it's interesting indeed. Essentially, you have two big drawings and the result of their overlay. Then you seemingly take a subset of each of the original drawings (correct?) and the result of their overlay loses some objects and gains some as well. We'll check what is going on.

Thanks a lot for the example data.

adamw


9,445 post(s)
online
#30-Nov-20 14:45

Found it. This seems to be our bug. The behavior is related to the tolerance value, indeed, if you set tolerance to 0, it isn't happening.

Here is an easy test (all coordinate systems are the same, so no need to convert anything):

--SQL9

FUNCTION GetGeom(@t TABLE, @id INT64GEOM AS (

  SELECT [geom] FROM @t WHERE mfd_id = @id

END;

 

-- the following ? tests should each be on a single line, I split them into

-- two lines for readability

 

? GeomContains(

    GetGeom([roadsmerged_mainset], 1), GetGeom([parcelsmainset], 1555), 4)

-- false

? GeomContains(

    GetGeom([roadsmerged_subset], 1), GetGeom([parcelssubset], 1555), 4)

-- true, but should be false

We'll fix it.

yves61
192 post(s)
#30-Nov-20 15:32

Adam, thank you.

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