I can create a custom marker as a png, and specify its path in the filesystem, in the setting "Marker icon path" in the Settings for "Geolocation CommonMap"

However the anchor point, i.e. the point within the market/peg upon which it is "pinned" to the map, cannot be set. This point is the actual latitude longitude co-ordinates.

I want to be able to define the anchor point so that the marker suitably marks a position on the map. For example for the traditional inverted tear drop shape map markers, the thin end tip is the anchor point.

At the moment my custom markers can be plotted on the map, but each of their anchor points is the top left corner of their png image.

The attached screenshot illustrates how the custom markers are (incorrectly) positioned compared with the default marker.

Comments

therobyouknow created an issue. See original summary.

therobyouknow’s picture

Issue summary: View changes
didebru’s picture

I have the same problem my solution so far is a hardcoded patch, not nice!
I have tried to implement 2 more form number fields but was unable to put them in the markerSettings object as it was not clear to me where the switch from drupal to js happened.
If anyone can point it where the $this->options variable from the CommonMapBase.php Class is give to js I will write a patch.

https://stackoverflow.com/questions/17875438/leafletjs-markers-move-on-z...

This is done in the geolocation-leaflet-api.js file but without iconSize and iconAnchor.

Another approach could be to get the width and height directly from the image file via php and than divide width(x) by 2 for the anchor.

christianadamski’s picture

Status: Active » Postponed (maintainer needs more info)
didebru’s picture

Oh I am sorry have overseen that I'll give it a try! Yes it worked but I would remove the form element to set the icon path in commonmapbase.php than.

christianadamski’s picture

Title: Need to set Anchor point for custom marker/pegs used with OpenStreetMap » Remove marker icon path in CommonMapBase
Status: Postponed (maintainer needs more info) » Needs work

Hijacking this issue as the original problem was fixed by the linked issue.

- Write update hook to copy marker icon path from views style to either Google or Leaflet Map Feature
- remove setting

christianadamski’s picture

Status: Needs work » Closed (outdated)