Join tables in model builder

3911
5
07-29-2015 02:24 AM
ManuelFrias
New Contributor II

Hi,

I am building a model to fetch tables with point data from a folder and make lines. Each file contains one week  of AIS (Automatic Identification System) data, i.e. shipping data.

The attribute table of the points contain the following fields

TablePoints.PNG

For making the lines I am using a publicly available script called TrackBuilder. The attribute table of the lines look like this:

TrackBuilderResultTable.PNG

The problem is that the field "shipType" is missing. I would like to modify the script (see attachment) to get that field in the lines attribute table.

I thought I could add a join to the model but I didn't succeed.

ModelPointsToLines.PNG

As you see above, the TrackBuilder script doesn't output a feature dataset that I can use to join it with the point table and get the "shipType".

TrackBuilderMenu.PNG

Any ideas on how to modify the script or alternative solutions are welcome!

0 Kudos
5 Replies
DanPatterson_Retired
MVP Esteemed Contributor

You need a field in each table which contains a common identifier if you are trying to do an attribute join.

About joining and relating tables—Help | ArcGIS for Desktop

Alternately, are you wanting to a join by spatial location? Spatial Join—Help | ArcGIS for Desktop

ManuelFrias
New Contributor II

Thanks Dan,

yes, the join can be made with the mmsi field. I just want to make a attribute join, not spatial join.

The problem is that the result of the TrackBuilder script goes directly to the geodatabase. There is no output green "bubble"

0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor

When you use the join 'bubble' you need to specify inputs...that is where you would specify the input fields from both files

0 Kudos
FreddieGibson
Regular Contributor II

You'll need to use the Make Feature Layer tool against your target table (i.e. the table where you want to see the join). The Join tool's first input must be a layer type as joins and selections can only be applied to layer objects.

Make Feature Layer

http://desktop.arcgis.com/en/desktop/latest/tools/data-management-toolbox/make-feature-layer.htm

Add Join

http://desktop.arcgis.com/en/desktop/latest/tools/data-management-toolbox/add-join.htm

If you look at the Add Join tool you'll see that the first parameter is ​"in_layer_or_view".

http://desktop.arcgis.com/en/desktop/latest/tools/data-management-toolbox/add-join.htm

ManuelFrias
New Contributor II

Yes, thanks,

that would solve the problem if the script "TrackBuilder" had an output with which I could do the join. But, as you see, nothing comes out of it. The result FC goes directly to the geodatabase

ModelBuilderJoin.PNG

To me this seems to be an issue with that script, how to edit it so that it outputs something to make the join with?

I am trying an alternative solution here

0 Kudos