Question

snap line endpoints to point features using common attribute

  • 15 April 2016
  • 6 replies
  • 18 views

Hello,

I'm trying to snap two line feature layers to one of two separate point feature layers. In the line layers there is a owner1 field and a owner2 field, on the point layers there is a ownerid. Hopefully the screen shot below helps clear it up a bit. I tried using the anchoredsnapper using the owner1 and owner2 as the group by and a snapping tolerance of up to 75 feet which is much larger than I should need. I had the line layers going into the candidate and the point layers in as the anchors. I have not used this transformer before so I'm not sure if i'm using it correctly. I'm getting features to snap, but most com out as untouched. I expected that to have far more of the lines snap. Any help of ideas would be appreciated, thanks.

field. I want the point features to be what the lines snap to. Either of the owner fields in the line layers can match the owner field in either point layer.


6 replies

Userlevel 2
Badge +17

Hi @jknakes, the "Group By" attribute has to be common to both Anchor features (points) and Candidate features (lines). In this case, I think that you have to add a new common group identifier attribute to the features to make groups by the condition where "OwnerID = Owner1 OR OwnerID = Owner2" before snapping. A possible way I can think of is:

  1. Give a sequential number attribute (e.g. "_count") to every line with the Counter. This number can be used as the group identifier later.
  2. Add a FeatureMerger to the workspace, send the points to the Requestor port, and send the lines to the Supplier port. Set "OwnerID" for Requestor (points) and "Owner1" for Supplier (lines) to the "Join On" parameter, and specify a list name (e.g. "_list") to the "List Name" parameter.
  3. Add another FeatureMerger to the workspace parallel to the first one, and set parameters as the same, but set "Onwer2" for Supplier (lines) to the "Join On" parameter here.
  4. Connect a ListExploder to Merged ports of the two FeatureMerger. Set the list name to the "List Attribute" parameter, and set "Use Incoming List" to the "Conflict Resolution" parameter. This duplicates the points by the number of lines that match the condition "OwnerID = Owner1 OR OwnerID = Owner2", and the points will have "_count" that indicates a corresponding line.
  5. Then, add an AnchoredSnapper. Send the points from the ListExploder to the Anchor port, send the original lines to the Candidate port, and set the "_count" to the "Group By" parameter.

The workflow looks like this.

Hope this helps.

Badge +3

If you use both owner id's as group by then it will only snap if there is 1 owner and matching.

So either send it in twice, for each owner id.

Also you should be able to merge it with only one featuremerger, using conditional merge.

requestor:

 

Condition "OwnerID = Owner1 OR OwnerID = Owner2"= 1, value = 1 else 0.

Supplier: 1

Userlevel 2
Badge +17

Hi @jknakes, the "Group By" attribute has to be common to both Anchor features (points) and Candidate features (lines). In this case, I think that you have to add a new common group identifier attribute to the features to make groups by the condition where "OwnerID = Owner1 OR OwnerID = Owner2" before snapping. A possible way I can think of is:

  1. Give a sequential number attribute (e.g. "_count") to every line with the Counter. This number can be used as the group identifier later.

  2. Add a FeatureMerger to the workspace, send the points to the Requestor port, and send the lines to the Supplier port. Set "OwnerID" for Requestor (points) and "Owner1" for Supplier (lines) to the "Join On" parameter, and specify a list name (e.g. "_list") to the "List Name" parameter.
  3. Add another FeatureMerger to the workspace parallel to the first one, and set parameters as the same, but set "Onwer2" for Supplier (lines) to the "Join On" parameter here.

  4. Connect a ListExploder to Merged ports of the two FeatureMerger. Set the list name to the "List Attribute" parameter, and set "Use Incoming List" to the "Conflict Resolution" parameter. This duplicates the points by the number of lines that match the condition "OwnerID = Owner1 OR OwnerID = Owner2", and the points will have "_count" that indicates a corresponding line.

  5. Then, add an AnchoredSnapper. Send the points from the ListExploder to the Anchor port, send the original lines to the Candidate port, and set the "_count" to the "Group By" parameter.

The workflow looks like this.

0684Q00000ArKSFQA3.png

Hope this helps.

@jknakes, alternatively the InlineQuerier can be used effectively in this case.

0684Q00000ArMStQAN.png

SQL statement example

select a.*, b._count
from Point as a inner join Line as b
on a.OwnerID = b.Owner1 or a.OwnerID = b.Owner2 

@takashi Could you possibly elaborate on your model set up? I'v have not used any of these transformers before and am not really understanding the process of how this should work and the use of them. I have my two point features going into a counter and have the "Counter name" set to the OwnerID. on the two line features would i have two counters? link both into the first counter and have that set to owner1 and the second to owner2? this is what i've tried putting together from your descriptions.

Userlevel 2
Badge +17

@takashi Could you possibly elaborate on your model set up? I'v have not used any of these transformers before and am not really understanding the process of how this should work and the use of them. I have my two point features going into a counter and have the "Counter name" set to the OwnerID. on the two line features would i have two counters? link both into the first counter and have that set to owner1 and the second to owner2? this is what i've tried putting together from your descriptions.

@jknakes, sorry for the vagueness of my screenshot. The 'points' and 'lines' shown in the screenshot just represent the source feature types (Points and Lines). Please replace them with appropriate reader feature types (Points and Lines), rather than transformers.

My intention is to use a Counter to create a temporary ID attribute unique for each line, which can be used as the 'Group By' parameter in the AnchoredSnapper.

Firstly add the ID to the Line features, and then merge the ID to the Point features based on the condition where [Point]OwenrID = [Line]Owner1 OR [Point]OwnerID = [Line]Onwer2

@jknakes, sorry for the vagueness of my screenshot. The 'points' and 'lines' shown in the screenshot just represent the source feature types (Points and Lines). Please replace them with appropriate reader feature types (Points and Lines), rather than transformers.

My intention is to use a Counter to create a temporary ID attribute unique for each line, which can be used as the 'Group By' parameter in the AnchoredSnapper.

Firstly add the ID to the Line features, and then merge the ID to the Point features based on the condition where [Point]OwenrID = [Line]Owner1 OR [Point]OwnerID = [Line]Onwer2

in my own case I have points and lines, I want to snap the lines to the points, both edges, ends and sides. I tried using the snapper and also tried using the anchored snapper, but still don't get to snap some. I have used intersector, it does the major part of the snapping but creates new points at any intersection without a point. I really would love to do this snapping based on relationship (attribute)

Reply