I’m working on a gps application for a Pocket PC 2003. After starting the Application the display has to show the map, on a certain zoom level with the current GPS position displayed as an icon or something in the centre of the map. Naturally this position
has to move when the user changes his position.
It doesn’t sound that difficult. I get the current GPS position from a timer control, transform the coordinates to my coordinate system, and assign them to the map centre and to an icon or ellipse or something. If I do this within the gps timer control I should
get a moving position. And somewhere in between I set the zoom level.
That’s the theory. The implementation of those ideas is a different thing. Somehow my map doesn’t care much about zooming or moving. The centre function only works when I put the coordinates in directly. But if I try to get them from the gps and set the centre
to those coordinates it won’t work.
Here is the offending code snipped:
Dim currentX = koordGK.getX_GKoord()
Dim currentY = koordGK.getY_GKoord()
myOsnaMap.Center = New SharpMap.Geometries.Point(currentX, currentY)
I tested the Coordinates with a messagebox, so I now the functions getxGKoord and getYGKoord actually work, but appearently I’m still doing something wrong, because suddenly the map doesn’t load anymore (or is it maybe out of range, if there’s something
wrong with those coordinates?).
Another thing is that the zoom function, which is exactly the same as in the SharpMapCF example, won’t work, even before I started the GPS position stuff. And I don’t get why it isn’t zooming.
Private Sub btnZoomIn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnZoomIn.Click
myOsnaMap.Zoom = (myOsnaMap.Zoom / 4)
Maybe someone here has some ideas. Any hint will be welcome.
PS: I’m not working with the new SharpMap version but with an older compact framework version of SharpMap