Mapwingis issue using extents.moveto

Hello,
I am new to Mapwingis, shp files etc. etc.

No doubt I am missing something, but I am having some difficulty achieving the functionality I hoped the extents.moveto was going to provide.

All I am trying to do is centre the map without changing the zoom level to a location. In my test app I have created a button whos handler has only one line …
AxMap1.Extents.MoveTo(centereast, centersouth)

It all runs without issue, however it is not centering on my location.

Any instruction is greatly appreciated.

Thanks Paul T.

Hello @PaulT , and welcome.

It may seem strange, but the MoveTo function changes internal values for an extent object, but those values are not applied until you set them into something. When you change the values for the Extent owned by the Map, it’s no different from changing the values of a free-standing Extent object, since the object itself doesn’t know it’s owned by the Map.

Perhaps things could have been done differently, but as it is, you need to

  1. Get the current map extents
  2. Change the values for the object
  3. Set the modified Extents back into the map

In VB .NET, it would be

'' get the Map extents
Dim ext As Extents = AxMap1.Extents
'' change the extents
ext.MoveTo(centereast, centersouth)
'' set the extents back into the Map
AxMap1.Extents = ext

Regards,
Jerry

Hi Jerry,

Thanks for your prompt response. I am still getting used to the Mapwingis environment. My previous experience has been with Mapinfo, which is completely different, and familiarity with mapinfo is steering me wrongly fairly often.

In saying that, mapinfo has proved too top heavy, too slow and too unreliable for our field surveying applications, and Mapwingis is going to be great from what I have seen so far!!

Awesome product!!

While I was waiting your response I found the extent handler section in your example code, and actually had success calculating my own, but hey moveto is easier!! I enjoyed the exercise though.

Regards