MapWinGIS:SampleCode-VB Net:GoToXY

This is a back-up of the WIKI.
Not all links might work
We're working on a new wiki.

Main Page | Recent changes | View source | Page history | Log in / create account |

Printable version | Disclaimers | Privacy policy

Center the Map on a specific X, Y

This code snippet originally contributed by Azlan David will allow you to zoom to a specific X, Y location on the map, keeping your current zoom.

     'Original code posted by Azlan David
     'Repositions map with the current zoom on a new locations
     Private Sub SetMapCenter(ByVal x As Double, ByVal y As Double)
 
         Dim myExtents As MapWinGIS.Extents = AxMap1.Extents
 
         With myExtents
             .SetBounds(x - ((.xMax - .xMin) / 2), y - ((.yMax - .yMin) / 2), 0, _
             x + ((.xMax - .xMin) / 2), y + ((.yMax - .yMin) / 2), 0)
         End With
 
         AxMap1.Extents = myExtents
 
     End Sub

Posted by Shade1974 on 12/9/2005

Retrieved from "http://mapwindow.org/wiki/index.php/MapWinGIS:SampleCode-VB_Net:GoToXY"

This page has been accessed 4,439 times. This page was last modified on 9 December 2005, at 16:20.