The Geo (gb.map) class provides tools for editing map projections and formatting geographic data.
The Geo class has these methods:
Method | ReturnType | Description |
---|---|---|
DecToSex(Value As Float, Type As Integer) | String | The function formats the value into a sexagesimal value. For the type: Latitude = 1 and Longitude = 2. |
SexToDec(Value as String) As Float | Float | The function calculates a latitude or longitude value from a suitably formatted sexagesimal (string) value. |
MapPointToPixel(hMapPoint as MapPoint, Zoom As Integer) | Point | The function converts the coordinates of a geographic point (latitude/longitude) into an image point at a specified zoom level. |
MapPointToTile(hMapPoint as MapPoint, Zoom As Integer) | Point | The function converts the coordinates of a geographical point (latitude/longitude) into map coordinates (xTile/yTile) to a specified zoom level. |
PixelToMapPoint(hPoint As Point, Zoom As Integer) | MapPoint | The function converts the coordinates of a point in pixel coordinates at a specified zoom factor into the geographical coordinates latitude and longitude. |
PixelToTile(hPoint As Point) | Point | The function converts pixel coordinates into map coordinates. |
TileBounds ( X As Integer, y As Integer, Zoom As Integer ) | MapBounds | Returns a MapBounds object to a given tile (xTile / yTile) with given zoom factor. |
TileToMapPoint ( X As Integer, y As Integer, Zoom As Integer ) | MapPoint | Returns the top left MapPoint to a given tile (xTile / yTile) with given Zoom factor. |
Table 24.8.2.1.1 : Methods of the class Geo
The Map class contains the routines to draw the maps. After initialisation you have the possibility to change the map section as well as the zoom factor. Here is an example of how to initialise and display a map:
Public Sub ShowMap() Dim iZoom As Integer Dim fLatitude, fLongitude As Float Dim sCacheName, sTileName, sTilePattern As String Dim cArguments As New Collection ' Initialisierung iZoom = 13 sTileName = "OpenStreetMap" sTilePattern = "85.30.190.241/{z}/{x}/{y}.png" cArguments = Null sCacheName = Null fLatitude = 52.7905 ' °Breite Osterburg fLongitude = 11.7531 ' °Länge Osterburg MapView1.Map.AddTile(sTileName, sTilePattern, cArguments, sCacheName) MapView1.Map[sTileName].Copyright = " © OpenStreetMap" MapView1.Map[sTileName].Visible = True ' optional; Standard-Einstellung ist TRUE MapView1.Map.AddShape("P1") MapView1.Map!P1.AddPoint("Osterburg", MapPoint(fLatitude, fLongitude)) MapView1.Map.Center = MapPoint(fLatitude, fLongitude) ' MapView1.Map.Center = MapView1.Map!P1!Osterburg.Points ' Alternative Zentrierung auf die Marke P1 MapView1.Map.Zoom = iZoom MapView1.AllowEffect = True End ' ShowMap()
With these two lines from the source code excerpt above, you insert a prominent marker into the displayed map:
MapView1.Map.AddShape("P1") MapView1.Map!P1.AddPoint("Osterburg", MapPoint(fLatitude, fLongitude))