I am planning to create a component (aura/lwc) that allows users to select a location by dropping a marker on the map. I tried to go through the Documentation, but couldn't find anything related to this. Also are there any other options that provide this functionality.
Example:enter image description here


This is not possible using the standard out of box component. The current version renders the Map component using an iframe and does not expose the Map object or any events to handle mouse or click events.

You will need to roll your own Maps component if you need to achieve. A good place to start will be exploring the Maps JavaScript API. Look into how you can tie the Mouse click event documented here

Note that Salesforce locker will also come into play and it will be a lot easy to build with Visualforce and iframe inside LWC and use LMS to handle any messages to Lightning Container.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.