koul
koul

Reputation: 481

search lat/log from Adress using GMMap in Delphi

I wanted just and simply hit a normal full address in edit box and get it's position (lat/log) and mark it in the map. I don't have any clue about getting latitude and longitude from adress , I was searching in GMMap properties , I could not see it at all. Could you please a help on that ?

Thanks

Upvotes: 0

Views: 1207

Answers (1)

cadetill
cadetill

Reputation: 1552

To obtain a lat/lng from an address, you need to geocode it. To do that, put a TGMGeocode component, link it with the TGMMap and call Geocode method with the address.

A geocodification can return 1 or more results (until 10 with standard Google access). For example, if you geocode "Andorra" you will get 2 results, Andorra a country and Andorra a city from Spain. For this reason, the result of geocodification is an array (GeoResult). You can iterate it with Count property.

To know the lat/lng from a GeoResult, you need to read TGMGeocode[i].Geometry.Location property or TGMGeocode.GeoResult[i].Geometry.Location property (is the same)

Upvotes: 1

Related Questions