Support » Plugin: Ultimate Maps by Supsystic » Map Markers from KML File Float on Zoom

  • Resolved jwrightspplus

    (@jwrightspplus)


    I have several markers being loaded to a map via KML files, they each have a custom icon, they show up on the map fine.

    When I zoom in and out though the markers drift.

    The normally placed markers on the same map keep anchored as expected.

    I am using: Ultimate Maps Supsystic v 1.0.9 and Ultimate Supsystic PRO 1.0.1.
    Engine: Leaflet (OpenStreetMap)
    Map Type: Wikepedia Labs No Labels

    PHP v 7.2.13
    WordPress 5.1.1

Viewing 1 replies (of 1 total)
  • It appears that the issue is that the iconSize option is not being set for the KML markers.

    The fix I have come up with is:
    ultimate-maps-by-supsystic-pro > kml > js > lib > leaflet

    Lines 136 – 145

    if (ioptions.href) {
    	// save anchor info until the image is loaded
    	options.icon = new L.KMLIcon({
    		iconUrl: ioptions.href,
    		shadowUrl: null,
    		iconAnchorRef: {x: ioptions.x, y: ioptions.y},
    		iconAnchorType:	{x: ioptions.xunits, y: ioptions.yunits},
    	});
    }

    Changed to:

    if (ioptions.href) {
    	// save anchor info until the image is loaded
    	options.icon = new L.KMLIcon({
    		iconUrl: ioptions.href,
    		shadowUrl: null,
    		iconAnchorRef: {x: ioptions.x, y: ioptions.y},
    		iconAnchorType:	{x: ioptions.xunits, y: ioptions.yunits},
    		iconSize: {x: parseInt(ioptions.x) * 2, y: parseInt(ioptions.y)}
    	});
    }

    This is dependent upon a properly formatted <hotSpot> element with “pixel” units being set in the KML.

    • This reply was modified 5 months, 3 weeks ago by  jwrightspplus. Reason: Added code tag
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.