# Detecting densely labelled areas in ArcPy?

I'm trying to detect densely labelled areas for a given scale like explained below. so dense labelled area is the area having high rate of overlapping labels.

I'd like to detect densely labelled area to make inset maps to make labels clear for that areas. like explained in Map automation, create and populate inset maps for densely-labelled areas

I'm using ArcPy.

• Could you please provide more context to your question? A graphical example would be ideal along with a better definition of "dense labelled areas". – Aaron Dec 28 '12 at 17:50
• @Aaron i have provided more details. – geogeek Dec 28 '12 at 18:13
• If you are using 1 label per feature you could try to identify your AOI (inset map) by some kind of density functions. But if you are using some fancy labeling engine which may produce labels in random fashion than check labels coordinates (one by one) if they fell within the same region. This probably can be done with arcobjects as labels should be some kind of graphics. Otherwise you could convert your labels to annotations or points and than perform density functions. Just some loose sugestions. – Tomek Dec 28 '12 at 19:53
• i thought about converting labels to graphics then calculate density, using arcobjects that's possible, but i would like to use arcpy. i don't know if playing with dataframes and its locations is straight forward in arcobjects like in arcpy – geogeek Dec 28 '12 at 20:01

## 1 Answer

I've developed a model/method before for identifying areas/features that labels are overlapping. The work flow goes something like this:

1. Determine distance between features that labels usually overlap (e.g. 50ft, 500ft, 1000ft...etc).
2. Buffer labeled feature by distance from step 1.
3. Run Intersect tool on buffer result.
4. Join result of Intersect tool layer to original labeled layer. This should highlight those features that may have potential for label overlap (the ones that joined).
5. Add new field to labeled layer to define labeling conflict or not via Field Calculator tool.
6. Create two labeling classes (with leader line and w/o leader line) save out this result as layer file.

The leader lines for the conflict class features will help pull the labels farther apart for those features (reducing or eliminating overlap). All these steps may be modeled via ModelBuilder then exported out to a python script for future re-use/automation.

Alternatively, following steps 1-5 above you could create a bounding box layer (by dissolving result of Intersect tool) which you could plug into Data Driven pages for generating zoomed in insets for the conflict areas.