Custom marker icon to be centered at coordinates, not "above" them

Hello,
I use custom marker icons to display locations on the map. Since I need to use circles (standardized images) to display the markers, the locations appear slightly incorrect, since the marker icons sit "on top" of the indicated location, and are not centered around the location. Is there a way how to change this behaviour? I didn't find hints in the docs and no related posts here. I am using openlayers, so a solution could be specific to that.

Thank you!

Best regards
Simon

Hi,

This is indeed the default marker position when using custom marker images.

Unfortunately the marker anchors feature is currently only available for TTMSFNCGoogleMaps where you can use the Markers[].Anchor property to specify a custom marker anchor position.

However this is a good suggestion and we'll investigate if marker anchoring can be added for the TTMSFNCOpenLayers service as well.

That would be much appreciated! We cannot easily switch to Google Maps and currently our users complain that the display of the locations is misleading. Anything hacks with scaling the icon image cannot work because it will always scale down and align to the bottom, right?

I have done this by adjusting the latitude of the marker depending on the marker height and the zoom level. It is inelegant, and the marker must be repositioned each time the user changes zoom level, but it kind of works:

latoffset:=360/power(2, zoomlevel+1); // degrees per tile
latoffset:=latoffset/256; // degrees per pixel
latoffset:=latoffset*50; // 50 is half the marker height in pixels

TMSFNCOpenLayers1.addmarker(latitude-latoffset, longitude, ...

Dear support team,

sorry for not answering right away. I reviewed the suggestion and it appears a bit fragile and i would fear performance and accuracy issues. Any changes this get’s handled in the product any time soon? That would be much appreciated!
Best regards

Simon

Hi,

Marker anchors will become available in TTMSFNCOpenLayers with the next TMS FNC Maps release.

Sample code to center a marker image on the provided coordinates instead of above:

  m := TMSFNCOpenLayers1.AddMarker(TMSFNCOpenLayers1.Options.DefaultLatitude, TMSFNCOpenLayers1.Options.DefaultLongitude);
  m.Anchor.X := 0.5;
  m.Anchor.Y := 0.5;
  m.DefaultAnchor := False;

THank you, Bart! Can you already say, when the new release will be available? How will we learn from the availability? Is there a newsletter or so?

Thank you again!

Simon

Happy to help!

The TMS FNC Maps update was released last night.

Product releases with new features are announced on the Latest Releases page.

You can also subscribe to the TMS Software newsletter.

Could this also be used in the TTMSFNCMaps component, when TMSFNCMap.Service = msOpenLayers?

Hi Stefan,

Unfortunately service-specific features are only available in the separate components like TTMSFNCOpenLayers.
This is a technical limitation in TMS FNC Maps.
However this is a good suggestion and we'll have to investigate if the marker anchor feature can be made available for all supported mapping services in the future.