Select to view content in your preferred language

Changing spatial reference of the OverviewMap control

1275
4
09-28-2010 07:07 AM
NeilDuxbury
Deactivated User
Currently, the OverviewMap control has a few constraints on it:

  • It must have same spatial reference as the map control it's associated with

  • Spatial reference is set based on first layer that is added

  • Spatial reference cannot be changed

These constraints make the OverviewMap control difficult to use when it is associated with a map control whose spatial reference can change.

Could the OverviewMap control be enhanced so that it can support changing spatial reference?

For example, altering the MaximumExtent property so that it works in a similar manner to the Extent property on the Map control - allowing the spatial reference to be changed if there is no Layer set on the OverviewMap.

Thanks,
Neil
0 Kudos
4 Replies
dotMorten_esri
Esri Notable Contributor
Basically no. The overviewmap needs to be able to set its extent based on the map's extent, and therefore the same spatial reference limitation is required.
0 Kudos
NeilDuxbury
Deactivated User
Morten,

Thanks for your response.

I understand the constraint that the spatial reference of the overview map needs to be the same as the spatial reference of the map control.

However, at the 2.0 version of the API, the map control now has the ability to change it's spatial reference.

In this situation, there does not appear to be a way for the associated overview map control to be updated so that it also has this new spatial reference.

Can the overview map control be enhanced so that when the map control's spatial reference changes there is some mechanism to update the overview map control's spatial reference?

Thanks,
Neil
0 Kudos
dotMorten_esri
Esri Notable Contributor
The overviewmap is just another map control, so you would have to also clear its layers before clearing out /resetting the extent of the main map.
0 Kudos
NeilDuxbury
Deactivated User
Yes. You can do this by setting the Layer property of the overview map control to null.

To handle this situation, we've had to download the toolkit and modify the OverviewMap control so that the MaximumExtent dependency property has the following property changed callback.

        private static void OnMaximumExtentPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            OverviewMap ovmap = (OverviewMap)d;
            Envelope maxExtent = (Envelope)e.NewValue;
            if (ovmap.OVMapImage != null && ovmap.OVMapImage.Layers.Count == 0 && maxExtent != null && maxExtent.SpatialReference != null)
            {
                ovmap.OVMapImage.Extent = maxExtent;
            }
        }


This allows us to change the spatial reference of the overview map with a method like the following:

        private void ChangeOverviewMapSpatialReference(OverviewMap overviewMap, Layer overviewLayer, Envelope maximumExtent)
        {
            // Clear the existing overview layer so that spatial reference can be changed
            overviewMap.Layer = null;
            
            // Set maximum extent to set the spatial reference
            overviewMap.MaximumExtent = maximumExtent;

            // Set the new overview layer
            overviewMap.Layer = overviewLayer;
        }


Can the ability to change the spatial reference of the overview map control be added to the release version of the toolkit or will we need to maintain this change ourselves?

Thanks,
Neil
0 Kudos