0

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

leppie
  • 115,091
  • 17
  • 196
  • 297
koul
  • 431
  • 2
  • 10
  • 20
  • For forward (as well as reverse) geocoding use the `TGMGeoCode` component from GMLib. – TLama Jan 05 '15 at 09:41
  • I m using TGMGeoCode and TGMMarker too but could not see where is the propertie(s) , any idea ? do you have an sample ? – koul Jan 05 '15 at 09:47

1 Answers1

1

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)

cadetill
  • 1,552
  • 16
  • 24