I'm having an attribute table with a field called 'name' which represents the streetnames of an area. The streetnames are derived from OSM, but unfortunately not all street (or parts of streets) have a streetname related to them. I believe that the reason for this is due to the difference of streettype (primary, secundary etc). What I want to do is to fill these missing streetnames with the streetname of the street that is closest to the street with the missing name.

I believe the best option to do this is to calculate the field using a near function, but I'm not that experienced in Python or other programming language. Therefore, I'm not really sure if my theory is plausible and/or the right one.

I have added a screenshot of the attributetable to give you an idea:

enter image description here

  • 1
    Have you tried Spatial Join tool?
    – BERA
    Jan 8, 2020 at 13:20
  • Yes, the problem is that I don't have a layer with the information on the streetnames. So I need to use the same attribute table data to calculate the missing streetnames. Therefore, I believe the field calculator with a script using some sort of Near/Closet function could do the trick. Jan 8, 2020 at 13:24
  • Are you using ArcGIS Pro or something else?
    – PolyGeo
    Jan 8, 2020 at 13:36
  • Using ArcGIS Pro indeed Jan 8, 2020 at 13:37
  • You may need other filters, else the closest road will likely be a perpendicular street, with a completely unrelated name.
    – JGH
    Jan 8, 2020 at 13:38

1 Answer 1


calculate field does not directly use spatial relationships between features.

1) Select the roads without an empty value in the "name" field (in other words, with an non empty "name" (NOT "name" = '' ). Those are the roads that contain the information about road names that you are looking for.

2) Create a second layer from this selection

3) remove the selection and run "spatial join" to obtain the value of the nearest road with a name

4) use field calculator to update your "name" field (only for the selection of empty names)

EDIT : joining lines to lines could be an issue when several roads are crossing. In order to improve the matching, I would convert all lines to their vertices (vertices to point), run the spatial join then use a majority rule to determine the "best match".

  • When I try to spatial join the new layer containing only the street with the missing names, it results in no added streetnames. I believe this is due to the fact that the 'closets/nearest' street is the identical street segment without the name. What I mean is that when the spatial join searches for the closest street with a name it can not find it, since the closest street is the one withouth the same, since they share the same lines segment. Jan 8, 2020 at 13:42
  • 1
    my first two step mention that you have to take a subset of the line WITHOUT the missing names. I've edited my answer to clarify that. @BERA your suggestion would indeed accelerate the spatial join, but then there is an extra step to merge the two fc (the fastest method will depend on the size of the dataset)
    – radouxju
    Jan 8, 2020 at 14:27
  • Thanks for the suggestion, but for some reason I can not get it to work. I have made two seperate layers one with only the street with names and one with the street without names. The spatial join doesn't work to get the missing streetnames that are closests to the existing ones. Is there something else I'm missing? Jan 9, 2020 at 8:05
  • just to check your spatial join parameters : target features = all roads ; join feature = roads WITH valid names ; join operation : one to one ; match option : closest
    – radouxju
    Jan 9, 2020 at 12:39

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .