Select to view content in your preferred language

Appending a date field from one feature class to another in Modelbuilder

565
2
08-27-2023 08:37 AM
Labels (2)
Michele
Frequent Contributor

I am trying to take a date field in a polygon feature class and append/add/copy it to a polyline feature class using modelbuilder in arcpro. I keep getting an error that I cannot do this because the geometries (i.e. shape type) are different, but the date field has absolutely nothing to do with the geometry type. Is there a way to do this within modelbuilder?

2 Replies
SarahRijneke
Frequent Contributor

How do you have it set up currently? If multiple polylines intersect with the same polygon you may run into some issues.

I have created a model that uses the date field from a line feature class (roads) and assigns a DueDate field to a point feature class (potholes) using a date field as one of the inputs. The model searches for the nearest line feature and calculates the DueDate based on some minimum maintenance standards.

I set the Expression type to Arcade and this is what the inputs look like:

 

var AssignedDate = $feature.Date;
var Road = FeatureSetByName($datastore, 'Road');
var ConstructedRoad = Filter(Road, "CONSTRUCTED_DATE IS NOT NULL");
var line_fs = Intersects(ConstructedRoad, Buffer($feature, 200, "Meters"));

 

I use some geometry functions to find the nearest road segment and you should be able to access the date field using something like this:

 

for (var l in line_fs){
return l.date}

 

 

0 Kudos
Michele
Frequent Contributor

Hi Sarah,

Thanks for the suggestion.  I can't copy/paste my code because it's on a completely different network but basically I am using the polygon to line GP tool to convert an entire poly to a line (only 1 record in the table).  The polygon attribute table has a field with a date in it that I want to add/copy into the line feature class attribute table.  What you suggest makes sense, I'll have to see if I can get it to work for my case.

0 Kudos