Why does zooming to a selected feature in a point layer not zoom in?

4076
9
04-19-2017 10:00 AM
DarrenSmith
New Contributor III

I've experienced this same issue over the years and never been bothered to address it (until now).

The problem: When I select a single point feature in a point layer (usually with a large number of features covering a large area) and then do a zoom-to-selected, either via arcpy code or manually in Arcmap, the zoom doesn't zoom in to a sensible scale I.e manual zooming is required to get to a level where the selected feature is distinguishable.

Why is this. Do I need to set some kind of zoom-to-scale property or environment variable, or is it a problem with spacial indices or something along these lines? 

Tags (2)
0 Kudos
9 Replies
IanMurray
Frequent Contributor

I would guess since a single point doesn't have a true extent, it default to zooming in to a fractional subset of the original features extent.  If you have more than a single point that it can create an extent object that encompasses multiple points and returns a logical seeming zoom for the multiple objects.  In arcpy you can always manually reset the scale to a scale that makes sense using the maps dataframe properties.

IanMurray
Frequent Contributor

Funny this is something I've obviously witnessed many times but never really considered a bug.  If I zoomed to single points alot with arcpy scripts then I bet I would notice, but I use polygons mainly as input for tools and zooming to single polygons.  Since they do have actual extents its never a problem. 

DarrenSmith
New Contributor III

Thanks for your replies Ian. Yep, I'd figured that points is a different game to lines and polygons, but I'd assumed that they'd be a clever solution to calculate the appropriate level, since it's such a basic and common GIS operation. Hence the concern that the issue lies with my data or some env parameter that I need to adjust.

0 Kudos
IanMurray
Frequent Contributor

Well what level is "appropriate" is highly subjective and would depend greatly on the dataset(Dense small scale datasets would have very different parameters for zooming to a single point, than a large diffuse point dataset).  A solution for you if you were unhappy with the current zoom to selected features for a single point would be to make a make a new tool that would select to a certain scale on a selected point based on your needs.  As I find it now, I don't see that much need for it, since doing a manual select isn't that time consuming, and I already mentioned the options for adjusting within python.   

0 Kudos
LukeWebb
Occasional Contributor III

A single point could represent a city, or a 1 metre area of interest. I may have points located all around the globe...or not! So even taking a fraction of the total extent is not a good indicator, there is no right scale!

You could make a zoom to point add-in just for your data, but I cant see how to override the default zoom to functionality where it exists. (file --> zoom to, in attribute tables, etc, this is where extra functionality exposed to arcpy would be great! )

0 Kudos
IanMurray
Frequent Contributor

I think this was more of an issue where the OP was using arcpy to zoom to a select feature of a single point and not getting a scale that worked with what he was trying to do.  The behavior was replicated by the behavior within an ArcMap session when zooming to a single point. 

It would be interesting to do something like zoom to only selected feature for a point, where it calculates the maximum extent that would only include the selected point and not contain any other points.  Conversely, you could write a script to calculate the extent of the whole point set and divide by the count of all the points in the dataset(I think just from a cursory glance at zooming to single points of a larger point set, it zoom to ~1/20th the original scale I haven't explored much at all if there is variance based on how dense/diffuse the dataset is), giving you a more representative fractional zoom with respect to the density of the data, instead of just the base zoom to selected feature where you have no control of it. 

Again depending on the purpose their is such subjectivity on what scale or extent would be "correct" for the purpose there really is no one size fits all solution. 

0 Kudos
LukeWebb
Occasional Contributor III

I think what were saying is due to this being a Data Centric problem as a pose to a bug, there should be a method of choosing a "ZoomScale Field" / default scale value, similar to "Display Field" in the layer properties. Then you could populate the scale depending on your data / set a default thats relevant and it would seamlessly interface with the other ArcGIS windows / functionality

0 Kudos
DarrenSmith
New Contributor III

Thanks Ian and Luke. this is turning into an interesting discussion, which I guess was part of the original intention. I ended up going with the (suggested) approach of choosing a default extent and zooming to that whenever the selection only contained a single point. That workaround works pretty well for the current problem, because the data I'm working with has a standard scale.

However, in the past I've worked with many datasets where the frequency for points varies greatly spatially and thus the standard scale approach for a single point wouldn't work as well. Totally understand that this is not an easy thing to do, I'm just surprised that the current solution is so very bad in many cases. It seems that there should be some kind of research in how this can be improved. Would love to investigate some more myself, just need to find the time. 

0 Kudos
ChrisGoodman
New Contributor


This worked for me. When I only have a point feature, I create an envelope around it. I don't add the envelope to the map but zoom to the envelope instead of to the feature.

For my data, a 3 metre cube worked, but for other data it might work better with a bigger or smaller box size.

I add a bookmark because it is the only way to return to the zoomed in view, since the enveloping box is not stored anywhere.

Envelop SetEnvelope(MapPoint point) {
   double boxsize = 3.0;
   Debug.WriteLine($"Create a {boxsize}m box around point");
   Envelope env = EnvelopeBuilder.CreateEnvelope(point, point).Expand(boxsize, boxsize, false);
   return env
}

extent=SetEnvelope(point);

if ((extent != null) && (extent.IsEmpty == false))
{
  await mapView.ZoomToAsync(extent); 
  mapView.Map.AddBookmark(mapView, $"View of Point {point}", "Description");
}
else {
// just zoom to the feature or zoom to layer
}
0 Kudos