Opened 14 years ago

Closed 14 years ago

#113 closed defect (fixed)

Can't zoom out beyond initial map view

Reported by: andrewd Owned by: madair
Priority: P2 Milestone: 1.1
Component: Core Version: SVN
Severity: Critical Keywords:
Cc: Browser: All
External ID: Operating System: All
state: Approved


This happens in all of my Fusion layouts...I have a map with an 'initial view' area set. My layers are set to be viewed to a max of infinite. I have no base layers or scale ranges.

With that set up, when I load my Fusion map in the browser, the zoom slider is all the way at the bottom, so I can't pull it down to zoom out any more. I also can't seem to type in a larger scale in the status bar (I can type it, but it just resets back to where it was - unless I want to zoom in)...also, pressing the 'zoom out' tool does nothing for me either.

Since it affects more than just the navigator widget, it must be something bigger - something in MapGuide.js maybe?

Change History (23)

comment:1 by madair, 14 years ago

(In [1504]) re #113: small changes to fix this, most was already fixed in rev 1464 for #108

comment:2 by andrewd, 14 years ago

This doen't fix it for me....I tried with the 1.2 trunk and it seemed to be fixed in that, but that trunk had broken everything else. On advice from Jason, I tried the 1.1 branch instead, and it at least runs - but it doesn't seem to fix this bug. It looks like it should have this fix in it - but if it does, it's not working. I've tried it out, and see no change.

comment:3 by andrewd, 14 years ago

Any chance of applying this patch to the 1.1 branch, since the trunk is sort of out of commission for a while?

comment:4 by madair, 14 years ago

this is already in the 1.1 branch already and I just tested and it seems to be working properly for me. Is there a URL where we can see your app?

comment:5 by andrewd, 14 years ago

Since it happens on all of my apps, I've made a quick one that you can have access to:

If you need to log in, just use Anonymous (no password)....Note that you can't use the "Zoom out" tool, and if you try to change the scale to a larger number, it just reverts back to the max number it wants to put there...

comment:6 by madair, 14 years ago

I think I see what the problem is: in that Application definition there is no <InitialView> element defined, it should look like so (for Sheboygan):

<MapSet xsi:type="MapSetType">

<MapGroup id="sheboygan" xsi:type="MapType">

<!-- should be centered on intersection of Lower Fallss Rd and S.Taylor Dr. -->

<InitialView xsi:type="MapViewType">

<CenterX>-87.745061</CenterX> <CenterY>43.740283</CenterY> <Scale>8000</Scale>

</InitialView> <Map xsi:type="MapGuideLayerType">

<Type>MapGuide</Type> <SingleTile>true</SingleTile> <Extension>





  • in ADSK Studio MapDefinition editor, the "initial view" box is really the max extent for the map and these extents are set as the map extent when the MapDefinition is loaded in Fusion from MapGuide.

You can also set the initial extent in the URL: http://localhost:8008/mapguide/fusionOSGeo3/templates/mapguide/standard/?extent=-87.74740689295285,43.738716694573526,-87.74271510704716,43.74184930542647

comment:7 by andrewd, 14 years ago

But, why should I have to set an initial view? I have it set in Studio to use my map's initial view (why should I have to set it twice?), which works fine in AJAX and DWF. If Fusion fails to pick that up, then I'd say there's a bug...

Seems to me that if Fusion can't find an initial view, it should take the map's initial view....this may be a decent workaround though.

comment:8 by andrewd, 14 years ago

Actually, this potential workaround doesn't seem to work for me. Same problem...

comment:9 by madair, 14 years ago

your map has a max scale (in my browser) of 1:5741 and you are asking for an initial scale of 8050, try lowering that to something less than 5471 so you are zoomed in, e.g. try it with an initial scale of 2000.

comment:10 by andrewd, 14 years ago

well....i'm not really willing to use that as a workaround. My map has no max scale set. I need to be able to set my initial view and zoom out....Should it not function like ajax and dwf??

comment:11 by pagameba, 14 years ago

Milestone: 1.12.0

As far as I understand, there are two places where you can specify an extent related to the map (ignoring for the moment that you can also set predefined scales):

  • In the map definition, you can set an initial view
  • In the application definition (flexible layout), you can choose to use the map's initial view OR set a custom view.

There is nowhere to specify what the maximum extent of the data or map view is. I suppose that we could determine a maximum scale from inspecting the scale range of the layers in the map (these are already processed per layer for legend purposes).

We have had requests to support the concept of a maximum extent for the map (so users can't pan beyond a certain point) which also translates into a maximum scale for zooming out and I think this makes sense. The way we chose to implement this was to use the initial view in the Map definition as the maximum extent of the map and the custom view in the flexible layout/application definition as the starting point. This allows the same map definition to have different starting points for different applications, which is fairly flexible but can require a bit more configuration.

Perhaps a reasonable compromise would be to have a setting in the ApplicationDefinition that would allow you to choose to have a limited extent based on the map's initial view. This wouldn't be supported in Studio obviously, but perhaps we could convince Kenneth to put it in Maestro :)

We should also look at employing the layer's scale ranges for determining the maximum scale for zooming.

This is too much work for 1.1.

comment:12 by andrewd, 14 years ago

Milestone: 2.01.1

You're over complicating things. No one's asking to be able to set any max extents - Fusion seems to be doing that all too well on it's own, hence the problem. Fusion should allow you to zoom out as far as you like, if your layers are set to go to infinite, which is the behavior in AJAX and DWF viewers. Period. Make a map...view it in an AJAX layout...zoom out. Note that it works. Now make a Fusion layout. Zoom out. Note that you can't. There's the bug. Right now, Fusion v1.1 is totally undeployable for me. Since it works for the other viewers, why should it be such a hard fix? It seems to me like it's likely just someone setting a hard max limit on something, where they shouldn't be.

comment:13 by madair, 14 years ago

Resolution: wontfix
Status: newclosed

this is an artifact of the OpenLayers library. The DWF and AJAX viewers don't use OpenLayers as the mapping engine.

In theory you can do this by simply not specifying a maxExtent for the layer (or map) but you then end up with the default maxExtent of -180,-90,180,90 and maps in EPSG:4326 can zoom out to that, but it is definitely wrong for maps in other projections.

IMHO there are problems with the way that the map extent handling has been implemented in OpenLayers, and I suspect mostly due to OL origins as a map tiling client, but that is the behaviour that OpenLayers provides.

If you can provide an example of OpenLayers that allows zooming out beyond the maxExtent, please re-open this ticket with a link.

comment:14 by andrewd, 14 years ago

Well then - I guess this puts the nail in the coffin for Fusion for me (and surely I'm not alone - this is a pretty big bug)...I've provided as much as I can provide. I've given examples, and detailed descriptions. If this is where it ends, so be it. Sadly, count me done with Fusion...maybe in a year or two, it'll be usable.

comment:15 by pagameba, 14 years ago

Milestone: 1.12.0
Resolution: wontfix
state: NewAnalysing
Status: closedreopened

Mike, it wasn't my intention that we would not address this issue (sorry for the double negative there). I think Andrew's use case is as valid as ours, it just doesn't fit in the current architecture/limitations of our implementation. I do think that we need to look at this again for the 2.0 version and see if there isn't another way to work around the OpenLayers max extent issues while still preserving a mechanism to have a max extent for our needs.

Andrew, thanks for sticking with it this far, unfortunately, we can't address this in the scope of the 1.1 version.

I understand that you are frustrated with the limitations and bugs in Fusion and hopefully the next release will be more satisfactory to your needs and you will give us the benefit of your involvement again at that time.

comment:16 by pagameba, 14 years ago

Owner: changed from madair to pagameba
Status: reopenednew

I did a bit more thinking on this and some research in the OpenLayers code base. I'm still not exactly sure but what happens if we set the following:

  • on a layer:
    • maxExtent: null
    • alwaysInRange: true
    • displayOutsideMaxExtent: true
  • on a map:
    • fractionalZoom: true

I think then the maxResolution will be ignored and we don't really need to know what it is.

The alwaysInRange property seems to be the key to supporting this, but it is only in OpenLayers 2.7 so we definitely can't do this in Fusion 1.1.

We also need to establish a way to determine how to establish max extent in the application definition (could be another extension) - it wouldn't be available directly through studio but it could be set manually.

comment:17 by madair, 14 years ago

Milestone: 2.01.1
Owner: changed from pagameba to madair
Status: newassigned

looking into this further, I've found that:

  • in OL, layers (or the baseLayer in particular) MUST have a maxExtent property set, otherwise the geography calculations are messed up for any projection other than lon/lat; setting projection and units on the map object doesn't change this (but these should be set on the map anyway). The effect of this is that you can't pan the center of the viewport outside of the maxExtent.
  • in Fusion, we set the maxExtent to the bounds returned by LoadMap (which is the Studio 'initial view' setting with MapGuide, and the mapfile 'extent' value with mapserver). We can set an optional override of this value in the MapWidget extension if that is desired to allow panning outside the maxExtent
  • the issue of not zooming out beyond the initial view, was actually due to the maxScale value of 'Infinity'. (displayOutsideMaxExtent and alwaysInRange settings don't affect this). In this case, the maxScale parameter is not supplied to the OL Layer constructor, and the maxScale gets calculated internally in OL based on the maxExtent and viewport size. This can be fixed by substituting a large maxScale value e.g. 1:billion and then the user can zoom out to that scale value, and/or optionally set a maxScale value in the MapWidget extension.

If that analysis makes I'll go ahead and implement the changes. Since it doesn't depend on alwaysInRange, this can be implemented in Fusion 1.1

comment:18 by pagameba, 14 years ago

state: AnalysingApproved

I think it makes sense. If the maxscale of the map is infinity, we substitute a really large number for it and then openlayers works.

comment:19 by madair, 14 years ago

(In [1564]) re #113: if maxScale is Infinity, set it to an actual value; set a maxExtent for panning in AppDef MapWIdget extension.

comment:20 by madair, 14 years ago

Resolution: fixed
Status: assignedclosed

(In [1565]) closes #113: if maxScale is Infinity, set it to an actual value; set a maxExtent for panning in AppDef MapWIdget extension. patch applied to trunk

comment:21 by madair, 14 years ago

Resolution: fixed
Status: closedreopened

this caused a regression in existing apps in that the Navigator widget and overview map. Change it to set the OL scale value only if there is a <MaxScale> extension value for the MapWIdget. It can be set to really large number to allow zooming out to that scale, otherwise the value will be automatically calculated for layers with a maxscale of infinity

comment:22 by madair, 14 years ago

(In [1577]) re #113: fix for regression, explicitly set MaxScale in AppDef MapWidget extension to set limit for zooming out

comment:23 by madair, 14 years ago

Resolution: fixed
Status: reopenedclosed

(In [1578]) closes #113: fix for regression, explicitly set MaxScale in AppDef MapWidget extension to set limit for zooming out; applied to trunk

Note: See TracTickets for help on using tickets.