Showing the map
Showing and hiding
The map is not loaded until you ask for it (MapVisible is False at start). These calls show it:
| Call | What it does |
|---|---|
GotoAddress(Address) | Shows the map at an address (looked up with the Google geocoding service) and puts a marker on it. An empty address hides the map |
GotoLocation(LatLng, AAddMarker) | Shows the map at a position; the marker is added unless AAddMarker is False. A position of 0, 0 hides the map |
ShowMap(Address) / ShowMap(LatLng) | Shows the map, at an address or at a position |
HideMap | Clears the map (the page goes back to about:blank) |
GotoAddress and GotoLocation can be called again and again: when the map is already visible they move it, without loading the page once more. The methods that draw on the map (markers, shapes) show it first if it is hidden, and wait until it is ready.
A position is a TLatLng record, with Latitude, Longitude and an optional Description that becomes the text of the marker. The two class functions TextToCoord and CoordToText convert a coordinate from and to text, always with the dot as decimal separator, whatever the regional settings of the machine.
Location.Latitude := TEdgeGoogleMapViewer.TextToCoord(Latitude.Text);
Longitude.Text := TEdgeGoogleMapViewer.CoordToText(Location.Longitude);View mode and zoom
EdgeGoogleMapViewer.MapTypeId := mtHYBRID;
EdgeGoogleMapViewer.MapZoom := 12;MapTypeId | |
|---|---|
mtROADMAP | The default road map |
mtSATELLITE | Satellite images |
mtHYBRID | Satellite images with the roads and the names |
mtTERRAIN | A physical map of the terrain |
MapZoom is the zoom level (15 by default). When the user zooms the map, the OnMapZoom event tells you the new value.
Layers
| Property | Method |
|---|---|
MapShowTrafficLayer | ShowTraffic(Boolean) |
MapShowBicyclingLayer | ShowBicycling(Boolean) |
The property sets the value to use when the map is shown; the method changes it on the map that is on screen. Setting the property while the map is visible does both.

Controls
Every control of the map can be shown or hidden:
| Property | Default | Method |
|---|---|---|
MapShowZoomControl | True | ShowZoomControl |
MapShowTypeControl | True | ShowMapTypeControl |
MapShowFullScreenControl | True | ShowFullScreenControl |
MapShowStreetViewControl | False | ShowStreetViewControl |
MapShowPanControl | True | |
MapShowScaleControl | True | |
MapShowoverviewMapControl | True |
When the map goes full screen the form around it usually has to give up its space: the OnContainsFullScreenElementChanged event of the browser tells you so, and the demo hides its panels in it.
Colour scheme
EdgeGoogleMapViewer.MapColorScheme := csDARK; // or csLIGHTThe light and dark themes of the map. Changing it while the map is visible creates the map again, so a marker put before is no longer there.
Printing
ShowPrintUI opens the print panel of the browser, embedded in the form: the user can print the map as it is on screen.
