(Not Signed In)

Sign In

.NET Development: Please Explain Zoom

Bottom of Page

1 to 3 of 3

  1.  
    • CommentAuthorccharrett
    • CommentTimeNov 12th 2009
     
    Hello,

    We seem to be having some issues understanding how the various zoom properties should be used. After playing with the MapCtrl properties and reading the various GeoBase help, my understanding is the following:

    Zoom: (double) 0 - 18000 where the lower the value the zoom is near, and the greater the value the zoom is far.
    Zooms: (double array) length 20 where index 0 contains the smallest zoom value (near) and the largest index 19 contains the greatest zoom value (far).
    ZoomLevel: (integer) 0 - 19 reflects the current index in the zooms array. Again, 0 indicating the nearest zoom setting and 19 indicating the furthers zoom setting.
    MaxZoom: The furthest allowable zoom value.
    MinZoom: The closest allowable zoom value.

    However, we're finding that setting the ZoomLevel is actually having the opposite effect. The smaller the value (index) the further the map zooms out, and the larger the value the nearer the map zooms in. Obviously then the ZoomLevel does not correlate to the index in the Zooms array. The documentation also mentions that setting the Zoom property doesn't actually set it to the specified value, but rather the closest zoom value in the zooms array. Some clarification on this matter matter would be great.

    The other issue we ran into is that the MaxZoom and MinZoom work well when using the mouse wheel when the map is loaded using local gbfs files. However, the MaxZoom and MinZoom properties seem to have no affect when the map is loaded using a GeoStream server. Our current workaround is overriding the OnMouseWheel event and handling zooming in and out ourselves. Not sure if this is a known bug or not.

    Any help you can provide on the above issues is greatly appreciated.

    Thanks,
    Chris
    •  
      CommentAuthorPepitaL
    • CommentTimeNov 18th 2009
     
    Hi Chris,

    Thanks for being patient on that matter.
    In the MapCtrl.Zooms property, in the remarks, the documentation says "Zoom levels should always be ordered from lowest (least zoomed) to highest." This means that index 0 would be zoomed furthest out. The wording of this could be changed to make it less ambiguous, but the behaviour is as described in the documentation.

    In the remarks about the MapCtrl.ZoomLevel property, it says "When using TileMaps, this property... sets the exact zoom level, while using Zoom will cause the TileMap to zoom to the closest available ZoomLevel that is as big or larger than the requested Zoom". So this is true for TileMaps only.
    •  
      CommentAuthorSeanS
    • CommentTimeNov 19th 2009
     
    Some more information around zoom:

    The MapCtrl operates in two modes: local mode (data files located on the local machine) and GeoStream mode (data files located on a remote server). The operation mode is controlled by setting Repositories.Repository.
    CurrentThreadRepository to either a SimpleRepository or MultiRepository (local mode) or a GeoStreamRepository (GeoStream mode).

    When in local mode you should use the Zoom, MaxZoom and MinZoom properties to control the zoom of a MapCtrl. Zoom is a double value in the range 0.1 to 18000. These values represent the distance between the left and right edges of the visible map (measured in degrees) multiplied by 50. Zoom cannot be greater that 18000 because the earth only has a circumference of 360 degrees. The Zoom value can be thought of as an altitude value -- the larger Zoom is, the greater your altitude and the more you can see of the world. The MaxZoom and MinZoom properties control the maximum and minimum values (respectively) that Zoom can take.

    When in GeoStream mode you can still use the Zoom property, however using Zoom will cause the MapCtrl to zoom to the closest available ZoomLevel that is as big or larger than the requested Zoom value. The Zooms and ZoomLevel properties will control the available zooms of a MapCtrl in geostream mode. The ZoomLevel is an index into the Zooms array (and therefore must be an integer value, 0 or greater). Zooms is an array of zoom values, where each value represents the number of supertiles required to span the world horizontally. By modifying the first and last elements of the Zooms array the maximum and minimum zoom values can be controlled.

    The simplest way to control the zoom level of the map is to use the Zoom property (small values near, large values far). This will work in both local and GeoStream modes.

    In summary:

    * The Zoom property controls the map zoom in both local and GeoStream modes. Zoom is a double value in the range 0.1 to 18000. These values represent the distance between the left and right edges of the visible map (measured in degrees) multiplied by 50. This means a greater Zoom value represents a higher altitude and therefore a greater view of the world. When operating in GeoStream mode the Zoom values are rounded up to match the nearest corresponding value in the Zooms array.
    * The MaxZoom and MinZoom properties control the maximum and minimum allowable Zoom values when the MapCtrl is operating in local mode.
    * Zooms is an array of zoom values, where each value represents the number of supertiles required to span the world horizontally. This means that a larger value is a closer (nearer) zoom. The values in the array are arranged from smallest to largest. By modifying the first and last elements in the array the minimum and maximum zoom levels can be controlled.
    * The ZoomLevel property is an index into the ZoomLevels array. When operating in GeoStream mode and the ZoomLevel property is modified, the map will zoom to the zoom level specified at the corresponding index of the Zooms array.

1 to 3 of 3

  1.