Map displaying multiple image files

Topics: General Topics, SharpMap v2.0
Mar 27, 2009 at 3:30 PM
Hi,
I want to display a map of a country that is composed by multiple tif files as tiles i.e. each tif file displays only one part of the country
and is located side by side to the other tif files.

How to scroll through the country e.g. with the cursor keys - in this case new tif files have to be loaded dynamically.

Can anyone point me in the right direction?
Any help is much appreciated.

Martin
Apr 6, 2009 at 1:20 PM
This is how you can use the arrow keys to move along the map.  Enjoy!


protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {

            if (keyData != Keys.Up && keyData != Keys.Down && keyData != Keys.Right && keyData != Keys.Left)
                return base.ProcessCmdKey(ref msg, keyData);

            if (mapBox.Focused)
            {
                SharpMap.Geometries.BoundingBox bbox = null;

                if (keyData == Keys.Up)
                    bbox = new SharpMap.Geometries.BoundingBox(map.Envelope.Min.X, map.Envelope.Max.Y, map.Envelope.Max.X, map.Envelope.Max.Y + map.Envelope.Height);
                else if (keyData == Keys.Down)
                    bbox = new SharpMap.Geometries.BoundingBox(map.Envelope.Min.X, map.Envelope.Min.Y - map.Envelope.Height, map.Envelope.Max.X, map.Envelope.Min.Y);
                else if (keyData == Keys.Left)
                    bbox = new SharpMap.Geometries.BoundingBox(map.Envelope.Min.X - map.Envelope.Width, map.Envelope.Min.Y, map.Envelope.Min.X, map.Envelope.Max.Y);
                else if (keyData == Keys.Right)
                    bbox = new SharpMap.Geometries.BoundingBox(map.Envelope.Max.X, map.Envelope.Min.Y, map.Envelope.Max.X + map.Envelope.Width, map.Envelope.Max.Y);
                else
                    bbox = map.Envelope;

                map.ZoomToBox(bbox);
                mapBox.Refresh();
            }
          
            return base.ProcessCmdKey(ref msg, keyData);
        }
Apr 7, 2009 at 10:03 AM
Hi Dan,

thanks a lot for your answer. I'm using the dll's of Change Set 48252 which does not contain a MapBox. Do I have to change to an older version?

Martin
Apr 8, 2009 at 1:10 PM
The old version of MapBox was called MapImage