- Joined
- Oct 26, 2020
- Messages
- 93
I have a given Point - Object with some attributes and of course a point geometry.
Now i want to find out, if its position is nearer to a line-object "type A" or "type B":
In Example:

the red dot shows the position, yellow lines is "type A", green doted lines "type B"
I may find the shortest, direct connection by something like this:

and then (Step 2)

the next neighbour...
this leads to an object like this:

But this one does not show directly, wich line-object is the closer one, so that there is no direct way to grab the ID of "type A" or "type B".
So I've tried to "calculate" the nearst Object afterwards by using incapsulated if Statements...

unfortunately, this is not working correctly... plenty of "TBM Objekt ID rechnerisch" is 0, though there are values "TBM Obj ID LA" or "TBM Obj ID HA LA" to choose

for easier copy & paste:
{
var LAID = [Befund Gas La Id Haa Id].[TBM Obj Id LA];
var HAID = [Befund Gas La Id Haa Id].[TBM Obj Id HA LA];
var KEHA = [Befund Gas La Id Haa Id].[Kürzeste Verbindung (2)];
var KELA = [Befund Gas La Id Haa Id].[Kürzeste Verbindung];
var TBMID = IF(HasValue(LAID) AND (Not (HasValue(HAID))), LAID,
IF(HasValue(HAID) AND (Not (HasValue(LAID))), HAID,
IF(HasValue(LAID) AND HasValue(HAID) AND KELA < KEHA, LAID, HAID
)
)
);
return TBMID;
}
Anyone an Idea, what's wrong here OR EVEN BETTER how to set up the analysis to find the nearest neighbour directly ?!?!
Now i want to find out, if its position is nearer to a line-object "type A" or "type B":
In Example:

the red dot shows the position, yellow lines is "type A", green doted lines "type B"
I may find the shortest, direct connection by something like this:

and then (Step 2)

the next neighbour...
this leads to an object like this:

But this one does not show directly, wich line-object is the closer one, so that there is no direct way to grab the ID of "type A" or "type B".
So I've tried to "calculate" the nearst Object afterwards by using incapsulated if Statements...

unfortunately, this is not working correctly... plenty of "TBM Objekt ID rechnerisch" is 0, though there are values "TBM Obj ID LA" or "TBM Obj ID HA LA" to choose

for easier copy & paste:
{
var LAID = [Befund Gas La Id Haa Id].[TBM Obj Id LA];
var HAID = [Befund Gas La Id Haa Id].[TBM Obj Id HA LA];
var KEHA = [Befund Gas La Id Haa Id].[Kürzeste Verbindung (2)];
var KELA = [Befund Gas La Id Haa Id].[Kürzeste Verbindung];
var TBMID = IF(HasValue(LAID) AND (Not (HasValue(HAID))), LAID,
IF(HasValue(HAID) AND (Not (HasValue(LAID))), HAID,
IF(HasValue(LAID) AND HasValue(HAID) AND KELA < KEHA, LAID, HAID
)
)
);
return TBMID;
}
Anyone an Idea, what's wrong here OR EVEN BETTER how to set up the analysis to find the nearest neighbour directly ?!?!