FNC Map Marker Color

For FNC Maps using Google Maps
If I have 3 markers on my map and I want them all to be different colors, is the only way to do this is via the IconURL property to load a different Icon for each marker?
And
How do you change the default Marker color from Red to something else?

Thanks

Hi,

Please note that the red marker is the default marker as provided by the Google Maps API.
There are currently no other colors available.
You can indeed use the IconURL property to display a custom image for each marker.
The IconURL can be an URL to a remote image file, a local image file (with LocalFileAccess set to True) or Base64 encoded image data.

1 Like

Bart,
If I wanted to use base64 image data, would I do so with something like
Marker.IconURL:= 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALQAAAC0CAYAAAA9zQYyAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzA...';
If this isn't correct, could you provide a sample.
Thanks

Bart,

Actually I tested this and it works, so I can use a Base64 string (Constant) to load my different color marker pins without having to use the internet to grab the .png files each time.

1 Like

Thanks for confirming, this is indeed the correct approach.

Hi,
you can set a Color over OnustomizeMarker!

mColor is the Value of the Color.

procedure TfrmMaps.FNCMapsCustomizeMarker(Sender: TObject;
var ACustomizeMarker: string);
var st: String;
begin
st := Inttohex(mColor,8);
ACustomizeMarker := 'marker.setIcon(''http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=•|'+copy(st,7,2)+Copy(st,5,2)+copy(st,3,2)+''')';
end;

1 Like

The solution using a markerURL and chart.apis.google.com isn't working anymore. The URL is dead, Google recommends to use its new API to display custom markers Personnalisation des repères de base  |  API Maps JavaScript  |  Google for Developers
Do you plan to provide an access to this new feature ?

Thank you for your suggestion!
We'll consider adding support for the new Google API in a future version of TMS FNC Maps.

Alternatively you can still use the technique of using your own base64 image data described above.
The advantages of this technique are that your custom markers will be compatible between different mapping services and won't rely on the availability of an external service.

Of course but I have no solution to generate on the fly a custom marker (color change) in base 64...