I have a location URL parameter which I wish to display as a marker without having take any user action
Expected the JS in comments to work, so I substituted the last 3-lines which also does not display a marker @ fixed location
URL, eg:
?marker=(41.85903463238362, -73.600231171875)
const queryString = window.location.search; // from hidden link
const urlParams = new URLSearchParams(queryString);
range = urlParams.get('maxrange'); // miles
if ( urlParams.has('marker') ) {thismarker = urlParams.get('marker');} // marker coordinates
thismarker = thismarker.replace('(', '');
thismarker = thismarker.replace(')', '');
var tmp = thismarker.split(", ");
console.log(queryString); console.log(thismarker); console.log(tmp[0]);console.log(tmp[1]);
// var myLatLng = { lat: tmp[0], lng: tmp[1] };
// var marker = new google.maps.Marker({
// position: myLatLng,
// title: 'Marker'
// map: map });
// marker.setMap(map);
const bangalore = { lat: 12.97, lng: 77.59 };
addMarker(bangalore, map);
marker.setMap(map);
Hi,
Thank you for contacting us and I'd be happy to assist.
To troubleshoot and suggest the best way to achieve this, I'll need to see exactly how and where you're planning to show this dynamic map marker.
Can you please share temporary admin login details, along with the link to an example page with the map?
Note: Your next reply will be private and please make a complete backup copy, before sharing the access details.
regards,
Waqar
Thank you for sharing these details.
I noticed that in your view "Pilots Marker view", you're already using the custom shortcodes "[marker_lat]" and "[marker_lon]" to get the latitude and longitude values from the URL parameter "marker".
I used the shortcode "wpv-map-marker" to add a new map marker, that uses "lat" and "lon" attributes to get values from these two custom shortcodes:
( screenshot: hidden link )
[wpv-map-marker map_id="map-8" marker_id="marker-from-url" marker_title="This is a marker title" lat="[marker_lat]" lon="[marker_lon]"]This is the content of the marker popup.[/wpv-map-marker]
You can read more about all the supported attributes for the "wpv-map-marker" shortcode at:
https://toolset.com/documentation/programmer-reference/maps/maps-shortcodes/#wpv-map-marker
My issue is resolved now. Thank you!