Frequently Asked Component Specific Questions
Options |
Display all FAQ items |
Displaying items 1 to 1 of 1, page 1 of 1
<< previous next >>
TMS VCL WebGMaps
How to get the address at right click on the map and put a marker on this address
How to get the address at right click on the map and put a marker on this address
You can use the OnMapClick event to catch a mouse click on the map. Then use the TWebGMapsReverseGeocoding component to retrieve the address based on the Latitude and Longitude coordinates and add a marker with the Markers.Add() call.
Example:
procedure TForm8.WebGMaps1MapClick(Sender: TObject; Latitude, Longitude: Double; X, Y: Integer; Button: TMouseButton); begin WebGMapsReverseGeocoding1.Latitude := Latitude; WebGMapsReverseGeocoding1.Longitude := Longitude; if WebGMapsReverseGeocoding1.LaunchReverseGeocoding = erOk then WebGMaps1.Markers.Add(Latitude, Longitude, WebGMapsReverseGeocoding1.ResultAddress.FormattedAddress); end;