Reputation: 21
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;
Upvotes: 0
Views: 683
Reputation: 1552
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
Upvotes: 1