0

I have the basic part of the app/map working/displaying. But when I try to geocode multiple addresses and then display the markers, it only shows me the last address. Only the last address will show on the map.

  GMGeoCode1.Geocode('address 1 anytown st');
  GMGeoCode1.Geocode('address 2 anytown st');
    for I := 0 to GMGeoCode1.Count - 1 do
    begin
    GMGeoCode1.Marker.Add(GMGeoCode1.GeoResult [i] .Geometry.Location.Lat,
           GMGeoCode1.GeoResult [i] .Geometry.Location.Lng,
           GMGeoCode1.GeoResult [i] .FormatedAddr);
         GMGeoCode1.Marker.Items [i] .MarkerType := mtStyledMarker;
    end;
Alexandre Neukirchen
  • 2,713
  • 7
  • 26
  • 36
user3745651
  • 21
  • 1
  • 3
  • I got this part working by unsetting the property of the GMGeoCode for the Marker property. Now i am trying to add more than the basic 10 addresses to the gecode process. I went and applied for an apikey (server and browser) but neither of these keys makes a difference in the test project i have created. How can i get more than 10 addresses to geocode an place a marker for them on a map? – user3745651 Dec 23 '15 at 21:22

1 Answers1

1

The TGMGeoCode component can only store one geocoding. The GeoResult array is because a geocoding can return more than one result. For example, if you geocodes Toledo defining USA like region, you will get 4 results 1.- Toledo, Ohio 2.- Toledo, Oregon 3.- Toledo, Iowa 4.- Toledo, Washington

an the GeoResult will have 4 entries, one for each of the results.

If you want store all geocodifications, you need to add results to the TGMMarker every geocodification

cadetill
  • 1,552
  • 16
  • 24