3

I am currently building a model to help speed up part of the generation of a map I make occasionally for the Dept of Public Works I work with. I have the majority of the map already made and saved in an .mxd. What I'd like to do is be able to open the model, run it and it adds the extra two new layers built from other existing layers and then have the completed map.

Manually what is being done is this: I have the point layer Water_Breaks_1997_to_Current, which I run a Select by Attribute SQL search to remove approx 100 results that are in the layer but no longer needing to be mapped. This result is then saved as a new feature class Water_Breaks_on_Active_Line_DATEHERE. Then right clicking my other layer representing water mains know as wMain (line geometry), I execute a spatial join where the layer wMain to the newly made Water_Breaks_on_Active_Line_DATEHERE. A points to line with one to many cardinality. Then summary statistic it by having each line intersecting a point(s) get a SUM count of said points, so that I can symbolize the new feature class to show the count of which water mains have the most breaks occurring on it in the city.

Building model to speed up the process a bit has led to this.

The problem that is occurring in the model is the spatial join. When opened, it does not offer spatial statistics the same way as right clicking the feature class itself. But through searching older SE questions and geonet, I came up with you have to add a new field, right click for merge rule and I select the 'Sum' ability. Spatial join modelbuilder properties

At this point, I've validated the model, and run it in Edit mode multiple times. Each time it does everything I wish...except the summary statistic of the amount of points on each line. It shoots out a field populated full of 0 each time.

What step or option am I missing that is stopping this from being counted properly?

Using: ArcGIS 10.2.2

  • Are you talking about the field called Count in your screen shot? – Hornbydd Mar 31 '17 at 14:31
  • Yes, that is a field that I added while in Modelbuilder. When one of those fields is right clicked, it gives options. In this case, it allowed me to tell it to make Sum...but the returned results are 0. – twweepie Mar 31 '17 at 14:50
  • Well looking at the screen shot now it looks like you have not completed it as it should have a plus sign like the rest and expand out to show what field it is summing. May be you pressed cancel by mistake? – Hornbydd Mar 31 '17 at 14:59
  • I agree, it does not have the + symbol. So it seems I need to tell it to 'add imput field' for it to count, I think? I just tested it by telling it to Add imput of the object ID for the incoming break points...but it just did 1, 2, 3, 4....all the way up the Object ID number set. So that's not right. I need to figure out which field to attach to this input, it sounds like? Because counting isn't what's desired, rather the sum of amount of breaks (points) on a line segment. (Side note: I've got to go to 2.5 hour meeting...but thank you for your help and suggestions!) – twweepie Mar 31 '17 at 15:31
2

You should not be using a one-to-many relationship for your spatial join, since it will create a new record for each break that intersects a water main, and there will never be a count more than 1.

Use a one-to-one relationship, and do not add a count field. The spatial join will automatically create a Join_Count field which shows how many breaks intersect each wMain record.

Or, if you really need a "Count" field, you can add it before the one-to-one spatial join and use field calculator to set it's value to one. Then add a sum merge rule to this field during the spatial join to get the desired values.

see:

http://desktop.arcgis.com/en/arcmap/10.3/tools/analysis-toolbox/spatial-join.htm#

  • 1
    This worked for me, thank you! I thought it was a one-to-many cardinality due to multiple points to one line, but I guess it's been too long since I've studied that concept. Just have to figure out why the symbology isn't importing right but that's a minor topic that I can easily fix manually if need be. – twweepie Mar 31 '17 at 18:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.