The reason that it is "glued" to the map is that you are creating geometries. These geometries have a size and shape based on the projection, not on your zoomlevel. The zoomlevel will then tell the system how big they should be displayed.
What you want is to draw circles that stay the same. To do this, you can display points as circles and then apply a dynamic stle to them.
So first create a vecotr layer with a style:
var vectorLayer = vectorLayer = new OpenLayers.Layer.Vector('Locations (interactive)', {
styleMap: new OpenLayers.StyleMap({
"default": new OpenLayers.Style({
pointRadius: {radius},
fillColor: '#ff0000',
fillOpacity: 1.0,
strokeColor: '#000000',
strokeWidth: 2,
strokeOpacity: 1.0
})
})
}
As you can see, the radius is not set to a fixed value, but should be dictated by your data. To do so, make a Feature
var feature = new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.Point(lonLat.lon, lonLat.lat),
{
radius: 10
}
);
Now add the feature to your layer:
vectorLayer.addFeatures([ feature ]);
So no need to create a polygon, but make a feature out of it and style it the way you want to display it using the styleMap
of your layer.
It would be great to have this (and other features) but it currently cannot be done in ArcGIS out-of-the-box. This feature will likely not be available any time soon since ESRI seems to be putting 100% of their resources towards developing ArcGIS Pro. Even whe a user suggestion is ranked very high and receives a lot of upvotes, ESRI implments this new feature into Pro and calls it solved. (There are no Data Driven Pages in ArcGIS Pro yet)
However it could be done (unfortunately not easily) programatically with ArcObjects and Visual Studio.
Alternatively, there maybe some crude workarounds to your problem, one of which you've already alluded to and if you have a lot of index features and your AOI and index features do not change it seems like a good solution to me. What also comes to mind is exporting all labels to static annotations (and correct placement manually) then create a masking layer based on your distance parameter (buffer the index features by a desired value then once a feature class with buffers is created - create a negative mask by turning the buffers into holes inside a feature that is the maximum extent of your AOI.) Once you have the masking layer created, enable Advanced Drawing Options and use this layer to mask any other layer whose features ought to be hidden. The features not covered with the mask will be displayed. For this to work, the masking layer must be in the TOC but can be turned off and also any layer that is being masked cannot have any transparency set. If you use a transparency, masking is ignored. (Layers in the same data frame that do not participate in the Advanced Drawing Options can be transparent and masking of the other layers will still work) I do not remember if and if so how well masking works on layers with joins/relates.
Why are you trying to do this in ArcGIS if you have a working solution in QGIS?
Best Answer
Update 2
Update 1
if you want to catch zoom event, you should register your
zoomend
to map.example code:
try to use following code.
i hope it helps you...